[gnome-shell] workspacesView: Restore activation of (empty) workspaces



commit 6eb05af306a26eeb3c1e39b2033d0cda67431cc4
Author: Florian MÃllner <fmuellner gnome org>
Date:   Sat Dec 1 01:37:28 2012 +0100

    workspacesView: Restore activation of (empty) workspaces
    
    Clicking empty workspaces to leave the overview was broken by
    commit 830e701d13, restore the previous behavior.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689552

 js/ui/workspacesView.js |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 95d8ca5..3132238 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -444,19 +444,33 @@ const WorkspacesDisplay = new Lang.Class({
         this.actor.connect('allocate', Lang.bind(this, this._allocate));
         this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
         this.actor.set_clip_to_allocation(true);
-        let action = new Clutter.PanAction();
-        action.connect('pan', Lang.bind(this, this._onPan));
-        action.connect('gesture-begin', Lang.bind(this, function() {
+
+        let clickAction = new Clutter.ClickAction()
+        clickAction.connect('clicked', Lang.bind(this, function(action) {
+            // Only switch to the workspace when there's no application
+            // windows open. The problem is that it's too easy to miss
+            // an app window and get the wrong one focused.
+            if (action.get_button() == 1 &&
+                this._getPrimaryView().getActiveWorkspace().isEmpty())
+                Main.overview.hide();
+        }));
+        Main.overview.addAction(clickAction);
+        this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+
+        let panAction = new Clutter.PanAction();
+        panAction.connect('pan', Lang.bind(this, this._onPan));
+        panAction.connect('gesture-begin', Lang.bind(this, function() {
             for (let i = 0; i < this._workspacesViews.length; i++)
                 this._workspacesViews[i].startSwipeScroll();
             return true;
         }));
-        action.connect('gesture-end', Lang.bind(this, function() {
+        panAction.connect('gesture-end', Lang.bind(this, function() {
+            clickAction.release();
             for (let i = 0; i < this._workspacesViews.length; i++)
                 this._workspacesViews[i].endSwipeScroll();
         }));
-        Main.overview.addAction(action);
-        this.actor.bind_property('mapped', action, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+        Main.overview.addAction(panAction);
+        this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
 
         let controls = new St.Bin({ style_class: 'workspace-controls',
                                     request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT,



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