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
This commit is contained in:
Owen W. Taylor 2009-08-08 00:36:59 -04:00
parent 1f864fba7f
commit 5d0808e1c0

View File

@ -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,