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
This commit is contained in:
Florian Müllner 2011-06-21 22:02:32 +02:00
parent b9456caeb0
commit 52a342300a

View File

@ -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() {