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
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;