Bug 1468670 - Enablel Alt modifier key on Wayland r=stransky
authorTakuro Ashie <ashie@clear-code.com>
Wed, 20 Jun 2018 16:24:27 +0900
changeset 479814 98620eaa1b5c3674e52fe2ab95fc529e15af9883
parent 479813 9fccfa690e6b01b2115f391daa287b38c5b47fc7
child 479815 4dbd6590b2354c675d750e928357dd31fcdbe282
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1468670
milestone62.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 1468670 - Enablel Alt modifier key on Wayland r=stransky MozReview-Commit-ID: 3nxxJabsTkx
widget/gtk/nsGtkKeyUtils.cpp
widget/gtk/nsGtkKeyUtils.h
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -190,17 +190,21 @@ KeymapWrapper::Init()
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
         ("%p Init, mGdkKeymap=%p",
          this, mGdkKeymap));
 
     mModifierKeys.Clear();
     memset(mModifierMasks, 0, sizeof(mModifierMasks));
 
     if (GDK_IS_X11_DISPLAY(gdk_display_get_default()))
-        InitBySystemSettings();
+        InitBySystemSettingsX11();
+#ifdef MOZ_WAYLAND
+    else
+        InitBySystemSettingsWayland();
+#endif
 
     gdk_window_add_filter(nullptr, FilterEvents, this);
 
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
         ("%p Init, CapsLock=0x%X, NumLock=0x%X, "
          "ScrollLock=0x%X, Level3=0x%X, Level5=0x%X, "
          "Shift=0x%X, Ctrl=0x%X, Alt=0x%X, Meta=0x%X, Super=0x%X, Hyper=0x%X",
          this,
@@ -270,20 +274,20 @@ KeymapWrapper::InitXKBExtension()
         return;
     }
 
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
         ("%p InitXKBExtension, Succeeded", this));
 }
 
 void
-KeymapWrapper::InitBySystemSettings()
+KeymapWrapper::InitBySystemSettingsX11()
 {
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
-        ("%p InitBySystemSettings, mGdkKeymap=%p",
+        ("%p InitBySystemSettingsX11, mGdkKeymap=%p",
          this, mGdkKeymap));
 
     Display* display =
         gdk_x11_display_get_xdisplay(gdk_display_get_default());
 
     int min_keycode = 0;
     int max_keycode = 0;
     XDisplayKeycodes(display, &min_keycode, &max_keycode);
@@ -434,16 +438,26 @@ KeymapWrapper::InitBySystemSettings()
             }
         }
     }
 
     XFreeModifiermap(xmodmap);
     XFree(xkeymap);
 }
 
+#ifdef MOZ_WAYLAND
+void
+KeymapWrapper::InitBySystemSettingsWayland()
+{
+    // Not implemented yet, but at least Alt modifier should be handled to save
+    // popular usage.
+    mModifierMasks[INDEX_ALT] = 1 << 3;
+}
+#endif
+
 KeymapWrapper::~KeymapWrapper()
 {
     gdk_window_remove_filter(nullptr, FilterEvents, this);
     g_signal_handlers_disconnect_by_func(mGdkKeymap,
                                          FuncToGpointer(OnKeysChanged), this);
     g_signal_handlers_disconnect_by_func(mGdkKeymap,
                                          FuncToGpointer(OnDirectionChanged), this);
     g_object_unref(mGdkKeymap);
--- a/widget/gtk/nsGtkKeyUtils.h
+++ b/widget/gtk/nsGtkKeyUtils.h
@@ -169,17 +169,20 @@ protected:
 
     bool mInitialized;
 
     /**
      * Initializing methods.
      */
     void Init();
     void InitXKBExtension();
-    void InitBySystemSettings();
+    void InitBySystemSettingsX11();
+#ifdef MOZ_WAYLAND
+    void InitBySystemSettingsWayland();
+#endif
 
     /**
      * mModifierKeys stores each hardware key information.
      */
     struct ModifierKey {
         guint mHardwareKeycode;
         guint mMask;