[gnome-shell-extensions] apps-menu: Allow for keynav between categories/applications



commit 94941843e352946aa3355187969bb5e2c52a11c2
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Apr 5 18:04:56 2013 +0200

    apps-menu: Allow for keynav between categories/applications
    
    PanelMenu.Button listens to key-press-events on the corresponding
    menu to move focus to neighboring buttons on left/right arrow. In
    order to allow keynav from the category list on the left to the
    application list on the right and vice-versa, we may need to suppress
    the parent behavior depending on the currently focused actor, so
    overwrite the signal handler accordingly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693074

 extensions/apps-menu/extension.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index e88bbdc..3c1bc22 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -312,6 +312,17 @@ const ApplicationsButton = new Lang.Class({
         return false;
     },
 
+    _onMenuKeyPress: function(actor, event) {
+        let symbol = event.get_key_symbol();
+        if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
+            let direction = symbol == Clutter.KEY_Left ? Gtk.DirectionType.LEFT
+                                                       : Gtk.DirectionType.RIGHT;
+            if (this.menu.actor.navigate_focus(global.stage.key_focus, direction, false))
+                return true;
+        }
+        return this.parent(actor, event);
+    },
+
     _onVertSepRepaint: function(area) {
         let cr = area.get_context();
         let themeNode = area.get_theme_node();


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