[gtk/shifted-mnemonics] shortcuts: Ignore consumed modifiers for mnemonics




commit 0768cfb7dfcefac3bc7c7ccb6f9d6e9a96ad1dfb
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 2 18:33:44 2021 -0400

    shortcuts: Ignore consumed modifiers for mnemonics
    
    This is necessary to make mnemonics like Alt-1 work in
    layouts where numeric keys are shifted, like AZERTY.
    
    Fixes: #3912

 gtk/gtkshortcutcontroller.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkshortcutcontroller.c b/gtk/gtkshortcutcontroller.c
index cefccf5148..8db04d71e6 100644
--- a/gtk/gtkshortcutcontroller.c
+++ b/gtk/gtkshortcutcontroller.c
@@ -432,9 +432,11 @@ gtk_shortcut_controller_handle_event (GtkEventController *controller,
 
   if (event_type == GDK_KEY_PRESS)
     {
-      GdkModifierType modifiers;
+      GdkModifierType modifiers, consumed_modifiers;
+
       modifiers = gdk_event_get_modifier_state (event);
-      enable_mnemonics = (modifiers & gtk_accelerator_get_default_mod_mask ()) == self->mnemonics_modifiers;
+      consumed_modifiers = gdk_key_event_get_consumed_modifiers (event);
+      enable_mnemonics = (modifiers & ~consumed_modifiers & gtk_accelerator_get_default_mod_mask ()) == 
self->mnemonics_modifiers;
     }
   else
     {


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