[gnome-shell] appDisplay: Change pages with page down/up keys



commit 7b7c4568b2d9a605d7344d5e5da55c1082e8f221
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Thu Sep 12 17:20:07 2013 +0200

    appDisplay: Change pages with page down/up keys
    
    Add key bindings to app picker to allow change pages using
    the page up/down keys.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707979

 js/ui/appDisplay.js |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index e3545b0..262b46a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -335,6 +335,19 @@ const AllView = new Lang.Class({
             function() {
                 this._displayingPopup = false;
             }));
+
+        this.actor.connect('notify::mapped', Lang.bind(this,
+            function() {
+                if (this.actor.mapped) {
+                    this._keyPressEventId =
+                        global.stage.connect('key-press-event',
+                                             Lang.bind(this, this._onKeyPressEvent));
+                } else {
+                    if (this._keyPressEventId)
+                        global.stage.disconnect(this._keyPressEventId);
+                    this._keyPressEventId = 0;
+                }
+            }));
     },
 
     getCurrentPageY: function() {
@@ -441,6 +454,21 @@ const AllView = new Lang.Class({
         this._panning = false;
     },
 
+    _onKeyPressEvent: function(actor, event) {
+        if (this._displayingPopup)
+            return true;
+
+        if (event.get_key_symbol() == Clutter.Page_Up) {
+            this.goToPage(this._currentPage - 1);
+            return true;
+        } else if (event.get_key_symbol() == Clutter.Page_Down) {
+            this.goToPage(this._currentPage + 1);
+            return true;
+        }
+
+        return false;
+    },
+
     _getItemId: function(item) {
         if (item instanceof Shell.App)
             return item.get_id();


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