[gnome-shell/gnome-3-12] switcherPopup: Add a return value to _keyPressHandler



commit 0327bd0a9d771969f4bed0787721fedec7a9f616
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon May 26 15:27:16 2014 +0200

    switcherPopup: Add a return value to _keyPressHandler
    
    This allows us to handle keybindings that use Escape instead of just
    dismissing the popup unconditionally when we see an Escape press.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730739

 js/ui/altTab.js          |   10 ++++++++++
 js/ui/ctrlAltTab.js      |    4 ++++
 js/ui/status/keyboard.js |    4 ++++
 js/ui/switcherPopup.js   |    5 +++--
 4 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index e318375..ed9572a 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -167,6 +167,8 @@ const AppSwitcherPopup = new Lang.Class({
                 this._select(this._selectedIndex, this._nextWindow());
             else if (keysym == Clutter.Up)
                 this._select(this._selectedIndex, null, true);
+            else
+                return Clutter.EVENT_PROPAGATE;
         } else {
             if (keysym == Clutter.Left)
                 this._select(this._previous());
@@ -174,7 +176,11 @@ const AppSwitcherPopup = new Lang.Class({
                 this._select(this._next());
             else if (keysym == Clutter.Down)
                 this._select(this._selectedIndex, 0);
+            else
+                return Clutter.EVENT_PROPAGATE;
         }
+
+        return Clutter.EVENT_STOP;
     },
 
     _scrollHandler: function(direction) {
@@ -403,7 +409,11 @@ const WindowSwitcherPopup = new Lang.Class({
                 this._select(this._previous());
             else if (keysym == Clutter.Right)
                 this._select(this._next());
+            else
+                return Clutter.EVENT_PROPAGATE;
         }
+
+        return Clutter.EVENT_STOP;
     },
 
     _finish: function() {
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index e522909..1991197 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -165,6 +165,10 @@ const CtrlAltTabPopup = new Lang.Class({
             this._select(this._previous());
         else if (keysym == Clutter.Right)
             this._select(this._next());
+        else
+            return Clutter.EVENT_PROPAGATE;
+
+        return Clutter.EVENT_STOP;
     },
 
     _finish : function(time) {
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 8d6242d..0df0502 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -292,6 +292,10 @@ const InputSourcePopup = new Lang.Class({
             this._select(this._previous());
         else if (keysym == Clutter.Right)
             this._select(this._next());
+        else
+            return Clutter.EVENT_PROPAGATE;
+
+        return Clutter.EVENT_STOP;
     },
 
     _finish : function() {
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 176bc6a..2f8eb18 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -189,10 +189,11 @@ const SwitcherPopup = new Lang.Class({
 
         this._disableHover();
 
+        if (this._keyPressHandler(keysym, backwards, action) != Clutter.EVENT_PROPAGATE)
+            return Clutter.EVENT_STOP;
+
         if (keysym == Clutter.Escape)
             this.destroy();
-        else
-            this._keyPressHandler(keysym, backwards, action);
 
         return Clutter.EVENT_STOP;
     },


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