[gnome-shell/gnome-3-22] popupMenu: don't handle key presses directly if there are modifiers



commit 1878c84eef136714ded8a2efc6aee881a40d8798
Author: Ray Strode <rstrode redhat com>
Date:   Wed Oct 26 10:46:21 2016 -0400

    popupMenu: don't handle key presses directly if there are modifiers
    
    commit 1d58ea25ab6f0472bdeffc9170ece37d5dd71e64 changed the
    popupMenu code to handle key presses on source actors directly.
    
    This fixed keynav into the session gear menu at the login screen.
    
    Unfortunately, it also causes spurious pop ups if a modifier happens
    to be held down.
    
    This commit checks for modifiers and short circuits the up front
    key handling if any are found.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740043

 js/ui/popupMenu.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 0090aa3..52a58d6 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -783,6 +783,16 @@ const PopupMenu = new Lang.Class({
                 break;
         }
 
+        let state = event.get_state();
+
+        // if user has a modifier down (except capslock)
+        // then don't handle the key press here
+        state &= ~Clutter.ModifierType.LOCK_MASK;
+        state &= Clutter.ModifierType.MODIFIER_MASK;
+
+        if (state)
+            return Clutter.EVENT_PROPAGATE;
+
         let symbol = event.get_key_symbol();
         if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
             this.toggle();


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