From 4830808d2fb34f7927e086faf570f4fbdf3a717e Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 8 Aug 2009 00:41:46 -0400 Subject: [PATCH] When fading in window icons, use the final position not current position The onComplete when positioning windows may come before the final stage of the workspace positioning animation. So we can't use actor.get_transformed_position() to figure out where to put the icons. Compute the final position manually ourselves instead. http://bugzilla.gnome.org/show_bug.cgi?id=591123 --- js/ui/workspaces.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/js/ui/workspaces.js b/js/ui/workspaces.js index 72dbbfdc9..c3c3441f9 100644 --- a/js/ui/workspaces.js +++ b/js/ui/workspaces.js @@ -472,9 +472,19 @@ Workspace.prototype = { _fadeInWindowIcon: function (clone, icon) { icon.opacity = 0; icon.show(); - let [parentX, parentY] = icon.get_parent().get_transformed_position(); - let [cloneX, cloneY] = clone.actor.get_transformed_position(); - let [cloneWidth, cloneHeight] = clone.actor.get_transformed_size(); + // This is a little messy and complicated because when we + // start the fade-in we may not have done the final positioning + // of the workspaces. (Tweener doesn't necessarily finish + // all animations before calling onComplete callbacks.) + // So we need to manually compute where the window will + // be after the workspace animation finishes. + let [parentX, parentY] = icon.get_parent().get_position(); + let [cloneX, cloneY] = clone.actor.get_position(); + let [cloneWidth, cloneHeight] = clone.actor.get_size(); + cloneX = this.gridX + this.scale * cloneX; + cloneY = this.gridY + this.scale * cloneY; + cloneWidth = this.scale * clone.actor.scale_x * cloneWidth; + cloneHeight = this.scale * clone.actor.scale_y * cloneHeight; // Note we only round the first part, because we're still going to be // positioned relative to the parent. By subtracting a possibly // non-integral parent X/Y we cancel it out.