[gnome-shell] Use the size of the window, not of the clone to position windows



commit 5d0808e1c0c15a10962e3bf075025dd4aec181b6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Aug 8 00:36:59 2009 -0400

    Use the size of the window, not of the clone to position windows
    
    When Workspace._positionWindows is called, the clone might nto
    yet have its final size (because of the clone is is a clone of
    the window texture and the window texture isn't updated until
    right before painting.) So get the size from the MetaWindow
    instead ... the MetaWindow size is determined synchronously when
    the window is managed.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=590741

 js/ui/workspaces.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/workspaces.js b/js/ui/workspaces.js
index a48a305..db15e2b 100644
--- a/js/ui/workspaces.js
+++ b/js/ui/workspaces.js
@@ -448,14 +448,20 @@ Workspace.prototype = {
             xCenter = xCenter * global.screen_width;
             yCenter = yCenter * global.screen_height;
 
+            // clone.actor.width/height aren't reliably set at this point for
+            // a new window - they're only set when the window contents are
+            // initially updated prior to painting.
+            let cloneRect = new Meta.Rectangle();
+            clone.realWindow.meta_window.get_outer_rect(cloneRect);
+
             let desiredWidth = global.screen_width * fraction;
             let desiredHeight = global.screen_height * fraction;
-            let scale = Math.min(desiredWidth / clone.actor.width, desiredHeight / clone.actor.height, 1.0 / this.scale);
+            let scale = Math.min(desiredWidth / cloneRect.width, desiredHeight / cloneRect.height, 1.0 / this.scale);
 
             icon.hide();
             Tweener.addTween(clone.actor, 
-                             { x: xCenter - 0.5 * scale * clone.actor.width,
-                               y: yCenter - 0.5 * scale * clone.actor.height,
+                             { x: xCenter - 0.5 * scale * cloneRect.width,
+                               y: yCenter - 0.5 * scale * cloneRect.height,
                                scale_x: scale,
                                scale_y: scale,
                                workspace_relative: workspaceZooming ? this : null,



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