[gnome-shell/wip/re-search-v2: 18/29] workspaceThumbnail: Add keyboard nav to ThumbnailsBox



commit 046827ae832045ee63902e702fa46930cec1f4bd
Author: Tanner Doshier <doshitan gmail com>
Date:   Wed Aug 8 15:18:46 2012 -0500

    workspaceThumbnail: Add keyboard nav to ThumbnailsBox
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682050

 js/ui/overview.js           |    2 ++
 js/ui/workspaceThumbnail.js |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 1a37bec..cf2157e 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -251,6 +251,8 @@ const Overview = new Lang.Class({
         this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
         this._group.add_actor(this._thumbnailsBox.actor);
 
+        Main.ctrlAltTabManager.addGroup(this._thumbnailsBox.actor, _("Workspaces"), 'view-list-symbolic');
+
         // Add our same-line elements after the search entry
         this._overview.add_actor(this._group);
 
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 80bbc6d..d5a8051 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -496,6 +496,7 @@ const ThumbnailsBox = new Lang.Class({
     _init: function() {
         this.actor = new Shell.GenericContainer({ reactive: true,
                                                   style_class: 'workspace-thumbnails',
+                                                  can_focus: true,
                                                   request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
         this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
         this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
@@ -546,6 +547,8 @@ const ThumbnailsBox = new Lang.Class({
         this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
         this.actor.connect('scroll-event',
                            Lang.bind(this, this._onScrollEvent));
+        this.actor.connect('key-release-event',
+                           Lang.bind(this, this._onKeyRelease));
 
         Main.overview.connect('showing',
                               Lang.bind(this, this._createThumbnails));
@@ -1279,5 +1282,19 @@ const ThumbnailsBox = new Lang.Class({
             Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
             break;
         }
+    },
+
+    _onKeyRelease: function (actor, event) {
+        switch (event.get_key_symbol()) {
+        case Clutter.KEY_Up:
+            Main.wm.actionMoveWorkspace(Meta.MotionDirection.UP);
+            break;
+        case Clutter.KEY_Down:
+            Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
+            break;
+        case Clutter.KEY_Return:
+            Main.overview.toggle();
+            break;
+        }
     }
 });



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