From 70bba2bbcd65bc05f5ca6307a8d3ca0e6f86e9ef Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 28 Jul 2016 13:29:20 -0300 Subject: [PATCH] keyboard: avoid stray Meta modified While using the Keyboard shortcut editor dialog under Wayland, the user receives a key even when this key isn't present in the physical keyboard nor in the keymap. This is probably the result of Wayland inheriting from X's xkb. To work around that, simply filter out this modifier. https://bugzilla.gnome.org/show_bug.cgi?id=769063 --- panels/keyboard/cc-keyboard-shortcut-editor.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c index 04f28f984..f9b4c4aa6 100644 --- a/panels/keyboard/cc-keyboard-shortcut-editor.c +++ b/panels/keyboard/cc-keyboard-shortcut-editor.c @@ -24,6 +24,11 @@ #include "cc-keyboard-shortcut-editor.h" #include "keyboard-shortcuts.h" +/* + * Workaround to stop receiving a stray Meta modifier. + */ +#define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK) + struct _CcKeyboardShortcutEditor { GtkDialog parent; @@ -450,7 +455,7 @@ cc_keyboard_shortcut_editor_key_press_event (GtkWidget *widget, if (!editing) return GTK_WIDGET_CLASS (cc_keyboard_shortcut_editor_parent_class)->key_press_event (widget, event); - real_mask = event->state & gtk_accelerator_get_default_mod_mask (); + real_mask = event->state & gtk_accelerator_get_default_mod_mask () & ALL_ACCELS_MASK; /* A single Escape press cancels the editing */ if (!event->is_modifier && real_mask == 0 && event->keyval == GDK_KEY_Escape)