Bug 1508302 - Make IMContextWrapper::GetIMEName() refer XMODIFIERS env when gtk_im_multicontext_get_context_id() returns "wayland" r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 15 Mar 2019 06:37:59 +0000
changeset 522021 781fba7bac687ef83bc40bfa4f8e7f7800eaff27
parent 522020 ec0fcbde84b91eedd1d37bab07ce8aa61b241932
child 522022 6af97458ab5dbadc25bd9fb39f9526e69e483ab1
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1508302
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508302 - Make IMContextWrapper::GetIMEName() refer XMODIFIERS env when gtk_im_multicontext_get_context_id() returns "wayland" r=m_kato On Wayland, `gtk_im_multicontext_get_context_id()` returns `"wayland"`. However, we need to know actual IM which works behind Wayland. Fortunately, `XMODIFIERS` env includes IME name like "xim" case. Therefore, we can refer it instead. Differential Revision: https://phabricator.services.mozilla.com/D23469
widget/gtk/IMContextWrapper.cpp
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -401,17 +401,18 @@ nsDependentCSubstring IMContextWrapper::
     return nsDependentCSubstring();
   }
 
   nsDependentCSubstring im(contextIDChar, strlen(contextIDChar));
 
   // If the context is XIM, actual engine must be specified with
   // |XMODIFIERS=@im=foo|.
   const char* xmodifiersChar = PR_GetEnv("XMODIFIERS");
-  if (!im.EqualsLiteral("xim") || !xmodifiersChar) {
+  if (!xmodifiersChar ||
+      (!im.EqualsLiteral("xim") && !im.EqualsLiteral("wayland"))) {
     return im;
   }
 
   nsDependentCString xmodifiers(xmodifiersChar);
   int32_t atIMValueStart = xmodifiers.Find("@im=") + 4;
   if (atIMValueStart < 4 ||
       xmodifiers.Length() <= static_cast<size_t>(atIMValueStart)) {
     return im;