[gnome-shell] [WorkspaceView] Allow workspace switching using mousewheel + indicators



commit 337eab614e264524e10d7925456b4848bdf742d1
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Fri Jan 22 20:49:52 2010 +0100

    [WorkspaceView] Allow workspace switching using mousewheel + indicators
    
    Allow the user to switch between workspaces by scrolling on the indicators.
    Up = next workspace
    Down = previous workspace

 js/ui/workspacesView.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index d75e3e3..65d3480 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -703,6 +703,17 @@ SingleView.prototype = {
                 this._workspaces[i]._metaWorkspace.activate(global.get_current_time());
         }));
 
+       actor.connect('scroll-event', Lang.bind(this, function(actor, event) {
+            let direction = event.get_scroll_direction();
+            let activeWorkspaceIndex = global.screen.get_active_workspace_index();
+            let numWorkspaces = global.screen.n_workspaces;
+            if (direction == Clutter.ScrollDirection.UP && activeWorkspaceIndex < numWorkspaces - 1) {
+                this._workspaces[activeWorkspaceIndex+1]._metaWorkspace.activate(global.get_current_time());
+            } else if (direction == Clutter.ScrollDirection.DOWN && activeWorkspaceIndex > 0) {
+                this._workspaces[activeWorkspaceIndex-1]._metaWorkspace.activate(global.get_current_time());
+            }
+        }));
+
         this._indicatorsPanel.add_actor(actor);
 
         let [a, spacing] = actor.get_theme_node().get_length('border-spacing', false);



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