[gnome-shell/wip/rewindow: 56/58] workspace: Don't relayout windows when zooming workspace thumbnails



commit fa25ad74e28234e842fe6530fcb2060b5a226e34
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Aug 8 16:47:05 2012 -0300

    workspace: Don't relayout windows when zooming workspace thumbnails
    
    It looks ugly and busy to have windows shuffle around when I just wanted
    to look at my workspaces.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=582650

 js/ui/workspace.js |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 11a2a60..4a5f11e 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -982,6 +982,8 @@ const Workspace = new Lang.Class({
 
         this._positionWindowsFlags = 0;
         this._positionWindowsId = 0;
+
+        this._currentLayout = null;
     },
 
     setGeometry: function(x, y, width, height) {
@@ -1024,6 +1026,7 @@ const Workspace = new Lang.Class({
             clone = null;
 
         this._reservedSlot = clone;
+        this._currentLayout = null;
         this.positionWindows(WindowPositionFlags.ANIMATE);
     },
 
@@ -1252,6 +1255,7 @@ const Workspace = new Lang.Class({
         this._cursorX = x;
         this._cursorY = y;
 
+        this._currentLayout = null;
         this._repositionWindowsId = Mainloop.timeout_add(750,
             Lang.bind(this, this._delayedWindowRepositioning));
     },
@@ -1304,6 +1308,7 @@ const Workspace = new Lang.Class({
             clone.actor.set_position (this._x, this._y);
         }
 
+        this._currentLayout = null;
         this.positionWindows(WindowPositionFlags.ANIMATE);
     },
 
@@ -1341,6 +1346,8 @@ const Workspace = new Lang.Class({
 
     // Animate the full-screen to Overview transition.
     zoomToOverview : function() {
+        this._currentLayout = null;
+
         // Position and scale the windows.
         if (Main.overview.animationInProgress)
             this.positionWindows(WindowPositionFlags.ANIMATE | WindowPositionFlags.INITIAL);
@@ -1559,6 +1566,16 @@ const Workspace = new Lang.Class({
         return lastLayout;
     },
 
+    _rectEqual: function(one, two) {
+        if (one == two)
+            return true;
+
+        return (one.x == two.x &&
+                one.y == two.y &&
+                one.width == two.width &&
+                one.height == two.height);
+    },
+
     _computeAllWindowSlots: function(windows) {
         let totalWindows = windows.length;
         let node = this.actor.get_theme_node();
@@ -1586,9 +1603,18 @@ const Workspace = new Lang.Class({
         area.y += closeButtonHeight;
         area.height -= closeButtonHeight;
 
-        let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing, captionHeight);
+        if (!this._currentLayout) {
+            this._currentLayout = this._computeLayout(windows, area, rowSpacing, columnSpacing, captionHeight);
+        }
+
+        let layout = this._currentLayout;
         let strategy = layout.strategy;
 
+        if (!this._rectEqual(area, layout.area)) {
+            layout.area = area;
+            strategy.computeScaleAndRatio(layout);
+        }
+
         return strategy.computeWindowSlots(layout, area);
     },
 



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