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
This commit is contained in:
Owen W. Taylor 2009-08-08 00:41:46 -04:00
parent 02ee6f69b3
commit 4830808d2f

View File

@ -472,9 +472,19 @@ Workspace.prototype = {
_fadeInWindowIcon: function (clone, icon) { _fadeInWindowIcon: function (clone, icon) {
icon.opacity = 0; icon.opacity = 0;
icon.show(); icon.show();
let [parentX, parentY] = icon.get_parent().get_transformed_position(); // This is a little messy and complicated because when we
let [cloneX, cloneY] = clone.actor.get_transformed_position(); // start the fade-in we may not have done the final positioning
let [cloneWidth, cloneHeight] = clone.actor.get_transformed_size(); // 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 // Note we only round the first part, because we're still going to be
// positioned relative to the parent. By subtracting a possibly // positioned relative to the parent. By subtracting a possibly
// non-integral parent X/Y we cancel it out. // non-integral parent X/Y we cancel it out.