Always show the workspace thumbnails if there is a monitor to the right

If there is a monitor to the right it is very easy to overshot the
expanding thumbnails and enter the next monitor. So, in that case
we just always show it.

https://bugzilla.gnome.org/show_bug.cgi?id=641877
This commit is contained in:
Alexander Larsson 2011-03-18 14:49:27 +01:00 committed by Florian Müllner
parent 96f89ce4ae
commit b2df3fcd1d

View File

@ -590,9 +590,15 @@ WorkspacesDisplay.prototype = {
this._inDrag = false; this._inDrag = false;
this._cancelledDrag = false; this._cancelledDrag = false;
this._alwaysZoomOut = false;
this._zoomOut = false; this._zoomOut = false;
this._zoomFraction = 0; this._zoomFraction = 0;
this._updateAlwaysZoom();
global.screen.connect('monitors-changed', Lang.bind(this, this._updateAlwaysZoom));
this._nWorkspacesNotifyId = 0; this._nWorkspacesNotifyId = 0;
this._switchWorkspaceNotifyId = 0; this._switchWorkspaceNotifyId = 0;
@ -647,8 +653,8 @@ WorkspacesDisplay.prototype = {
Lang.bind(this, this._dragEnd)); Lang.bind(this, this._dragEnd));
this._onRestacked(); this._onRestacked();
this._zoomOut = false; this._zoomOut = this._alwaysZoomOut;
this._zoomFraction = 0; this._zoomFraction = this._alwaysZoomOut ? 1 : 0;
this._updateZoom(); this._updateZoom();
}, },
@ -707,6 +713,23 @@ WorkspacesDisplay.prototype = {
return this._zoomFraction; return this._zoomFraction;
}, },
_updateAlwaysZoom: function() {
this._alwaysZoomOut = false;
let monitors = global.get_monitors();
let primary = global.get_primary_monitor();
/* Look for any monitor to the right of the primary, if there is
* one, we always keep zoom out, otherwise its hard to reach
* the thumbnail area without passing into the next monitor. */
for (let i = 0; i < monitors.length; i++) {
if (monitors[i].x >= primary.x + primary.width) {
this._alwaysZoomOut = true;
break;
}
}
},
_getPreferredWidth: function (actor, forHeight, alloc) { _getPreferredWidth: function (actor, forHeight, alloc) {
// pass through the call in case the child needs it, but report 0x0 // pass through the call in case the child needs it, but report 0x0
this._controls.get_preferred_width(forHeight); this._controls.get_preferred_width(forHeight);
@ -842,7 +865,7 @@ WorkspacesDisplay.prototype = {
if (Main.overview.animationInProgress) if (Main.overview.animationInProgress)
return; return;
let shouldZoom = this._controls.hover || (this._inDrag && !this._cancelledDrag); let shouldZoom = this._alwaysZoomOut || this._controls.hover || (this._inDrag && !this._cancelledDrag);
if (shouldZoom != this._zoomOut) { if (shouldZoom != this._zoomOut) {
this._zoomOut = shouldZoom; this._zoomOut = shouldZoom;
this._updateWorkspacesGeometry(); this._updateWorkspacesGeometry();