[gnome-shell] Always show the workspace thumbnails if there is a monitor to the right



commit b2df3fcd1da6d7ad4912f6b6b77bce19cd8c30ce
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 18 14:49:27 2011 +0100

    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

 js/ui/workspacesView.js |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index d2a8851..f7250c6 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -590,9 +590,15 @@ WorkspacesDisplay.prototype = {
 
         this._inDrag = false;
         this._cancelledDrag = false;
+
+        this._alwaysZoomOut = false;
         this._zoomOut = false;
         this._zoomFraction = 0;
 
+        this._updateAlwaysZoom();
+
+        global.screen.connect('monitors-changed', Lang.bind(this, this._updateAlwaysZoom));
+
         this._nWorkspacesNotifyId = 0;
         this._switchWorkspaceNotifyId = 0;
 
@@ -647,8 +653,8 @@ WorkspacesDisplay.prototype = {
                                                           Lang.bind(this, this._dragEnd));
 
         this._onRestacked();
-        this._zoomOut = false;
-        this._zoomFraction = 0;
+        this._zoomOut = this._alwaysZoomOut;
+        this._zoomFraction = this._alwaysZoomOut ? 1 : 0;
         this._updateZoom();
     },
 
@@ -707,6 +713,23 @@ WorkspacesDisplay.prototype = {
         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) {
         // pass through the call in case the child needs it, but report 0x0
         this._controls.get_preferred_width(forHeight);
@@ -842,7 +865,7 @@ WorkspacesDisplay.prototype = {
         if (Main.overview.animationInProgress)
             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) {
             this._zoomOut = shouldZoom;
             this._updateWorkspacesGeometry();



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