[gnome-shell] Reposition windows when scaling workspaces



commit 06d17e08c06acb3168750251e85e76c51171a1b5
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Aug 8 00:45:06 2009 -0400

    Reposition windows when scaling workspaces
    
    The scale of windows within a workspace is determined by the
    scale of the workspace since we never scale a window bigger
    than the original size of the window. So when we rescale
    workspaces we have to rerun Workspace.positionWindows().
    
    http://bugzilla.gnome.org/show_bug.cgi?id=591124

 js/ui/workspaces.js |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspaces.js b/js/ui/workspaces.js
index c3c3441..82b7bcc 100644
--- a/js/ui/workspaces.js
+++ b/js/ui/workspaces.js
@@ -431,7 +431,7 @@ Workspace.prototype = {
     // Reposition all windows in their zoomed-to-overlay position. if workspaceZooming
     // is true, then the workspace is moving at the same time and we need to take
     // that into account
-    _positionWindows : function(workspaceZooming) {
+    positionWindows : function(workspaceZooming) {
         let global = Shell.Global.get();
 
         for (let i = 1; i < this._windows.length; i++) {
@@ -547,7 +547,7 @@ Workspace.prototype = {
         clone.destroy();
         icon.destroy();
 
-        this._positionWindows(false);
+        this.positionWindows(false);
         this.updateRemovable();
     },
 
@@ -584,7 +584,7 @@ Workspace.prototype = {
             clone.actor.set_scale (scale, scale);
         }
 
-        this._positionWindows(false);
+        this.positionWindows(false);
         this.updateRemovable();
     },
 
@@ -610,7 +610,7 @@ Workspace.prototype = {
                          });
 
         // Likewise for each of the windows in the workspace.
-        this._positionWindows(true);
+        this.positionWindows(true);
     },
 
     // Animates the return from overlay mode
@@ -1120,6 +1120,14 @@ Workspaces.prototype = {
                 this._workspaces[w].resizeToGrid(oldScale);
         }
 
+        if (newScale != oldScale) {
+            // The workspace scale affects window size/positioning because we clamp
+            // window size to a 1:1 ratio and never scale them up
+            let existingWorkspaces = Math.min(oldNumWorkspaces, newNumWorkspaces);
+            for (let w = 0; w < existingWorkspaces; w++)
+                this._workspaces[w].positionWindows(false);
+        }
+
         if (newNumWorkspaces > oldNumWorkspaces) {
             // Slide new workspaces in from offscreen
             for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++)



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