[gtk+/gtk-3-22] gdk/wayland: Don't add GDK_META_MASK to gdk mod masks if MOD1 is set



commit 33c10204e4671a6d1ca07c9ae8cfa30233fe0fb3
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Jan 11 18:33:11 2017 +0100

    gdk/wayland: Don't add GDK_META_MASK to gdk mod masks if MOD1 is set
    
    Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to be
    mapped around, so we should avoid adding GDK_META_MASK if MOD1 is
    already included to avoid confusing gtk+ and applications that rely on
    that behavior.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770112

 gdk/wayland/gdkkeys-wayland.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index 085d8e1..9c80d80 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -303,7 +303,13 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
     state |= GDK_SUPER_MASK;
   if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper")))
     state |= GDK_HYPER_MASK;
-  if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")))
+  /* Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to
+   * be mapped around, so we should avoid adding GDK_META_MASK if MOD1
+   * is already included to avoid confusing gtk+ and applications that
+   * rely on that behavior.
+   */
+  if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")) &&
+      (state & GDK_MOD1_MASK) == 0)
     state |= GDK_META_MASK;
 
   return state;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]