[gnome-shell] workspaces-view: Always update zoom on workspace changes



commit 52a342300ade9984cef81748ba3ab865c085c8d6
Author: Florian MÃllner <fmuellner gnome org>
Date:   Tue Jun 21 22:02:32 2011 +0200

    workspaces-view: Always update zoom on workspace changes
    
    With commit 59a3e393f9 whether the workspace pager should autohide
    now depends on the number of workspaces. As we only track changes
    to the number of workspaces while the overview is visible, we miss
    changes in "normal mode", i.e. when creating a new workspace by
    moving a window with ctrl-alt-shift-arrow; as a result, the pager's
    autohiding might be incorrect when entering the overview after that.
    As a fix, keep tracking changes to the workspaces when the overview
    is hidden and update the zoom options.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653078

 js/ui/workspacesView.js |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 9218a7b..19ec796 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -556,6 +556,9 @@ WorkspacesDisplay.prototype = {
         this._updateAlwaysZoom();
 
         global.screen.connect('monitors-changed', Lang.bind(this, this._updateAlwaysZoom));
+        global.screen.connect('notify::n-workspaces',
+                              Lang.bind(this, this._workspacesChanged));
+
         Main.xdndHandler.connect('drag-begin', Lang.bind(this, function(){
             this._alwaysZoomOut = true;
         }));
@@ -565,7 +568,6 @@ WorkspacesDisplay.prototype = {
             this._updateAlwaysZoom();
         }));
 
-        this._nWorkspacesNotifyId = 0;
         this._switchWorkspaceNotifyId = 0;
 
         this._itemDragBeginId = 0;
@@ -595,10 +597,6 @@ WorkspacesDisplay.prototype = {
         this.workspacesView = new WorkspacesView(this._workspaces);
         this._updateWorkspacesGeometry();
 
-        this._nWorkspacesNotifyId =
-            global.screen.connect('notify::n-workspaces',
-                                  Lang.bind(this, this._workspacesChanged));
-
         this._restackedNotifyId =
             global.screen.connect('restacked',
                                   Lang.bind(this, this._onRestacked));
@@ -629,10 +627,6 @@ WorkspacesDisplay.prototype = {
         this._controls.hide();
         this._thumbnailsBox.hide();
 
-        if (this._nWorkspacesNotifyId > 0) {
-            global.screen.disconnect(this._nWorkspacesNotifyId);
-            this._nWorkspacesNotifyId = 0;
-        }
         if (this._restackedNotifyId > 0){
             global.screen.disconnect(this._restackedNotifyId);
             this._restackedNotifyId = 0;
@@ -795,6 +789,12 @@ WorkspacesDisplay.prototype = {
         if (oldNumWorkspaces == newNumWorkspaces)
             return;
 
+        this._updateAlwaysZoom();
+        this._updateZoom();
+
+        if (this.workspacesView == null)
+            return;
+
         let lostWorkspaces = [];
         if (newNumWorkspaces > oldNumWorkspaces) {
             // Assume workspaces are only added at the end
@@ -830,8 +830,6 @@ WorkspacesDisplay.prototype = {
 
         this.workspacesView.updateWorkspaces(oldNumWorkspaces,
                                              newNumWorkspaces);
-        this._updateAlwaysZoom();
-        this._updateZoom();
     },
 
     _updateZoom : function() {



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