[mutter/wip/carlosg/locate-pointer-in-other-keybindings: 4/4] keybindings: Do not interpret "locate pointer" mixed with other keys



commit 95dc75f2deab8f8a704a44b6a703c0f9ad2ad001
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jan 22 15:30:12 2020 +0100

    keybindings: Do not interpret "locate pointer" mixed with other keys
    
    The default "left control" keybinding for the "locate pointer" feature makes
    this keybinding prone to be handled as part of another keybinding. One case
    is ctrl+alt+up/down for workspace switching.
    
    When the keys are pressed just right (first alt, then left ctrl, then up)
    the second keypress will enter through the process_locate_pointer_key()
    paths, but remain latent as it's not a key release yet. The third keypress
    would notice the mixed keypress and set locate_pointer_key_only_pressed to
    FALSE, but the keypress would otherwise still be considered as handled
    through these paths.
    
    This, combined with the default behavior to let events go through even
    though the "locate pointer" action is triggered, would result in the "up"
    key press being forwarded through wl_keyboard, with the previous alt
    modifier.
    
    To protect against this, only deem the "locate pointer" action to handle
    an event if the event is processed and the keybinding is the only key
    pressed.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/issues/812

 src/core/keybindings.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index b86272541..a70fd522b 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2168,13 +2168,18 @@ process_locate_pointer_key (MetaDisplay     *display,
                             MetaWindow      *window)
 {
   MetaKeyBindingManager *keys = &display->key_binding_manager;
+  gboolean retval;
+
+  retval = process_special_modifier_key (display,
+                                         event,
+                                         window,
+                                         &keys->locate_pointer_key_only_pressed,
+                                         &keys->locate_pointer_resolved_key_combo,
+                                         (GFunc) handle_locate_pointer);
+  if (!keys->locate_pointer_key_only_pressed)
+    return FALSE;
 
-  return process_special_modifier_key (display,
-                                       event,
-                                       window,
-                                       &keys->locate_pointer_key_only_pressed,
-                                       &keys->locate_pointer_resolved_key_combo,
-                                       (GFunc) handle_locate_pointer);
+  return retval;
 }
 
 static gboolean


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