Bug 570583: handle tweens being overwritten during window effects

Since tweener can't do multiple tweens on the same property, it
calls an overwrite callback for any existing tweens when a new
tween is added for the same property.  Here we use the overwrite
callback to tell mutter that the effects are done.
This commit is contained in:
Jonathan Matthew 2009-02-06 10:57:54 +10:00
parent fd69eeb87d
commit 6dd302e5ce

View File

@ -87,6 +87,15 @@ WindowManager.prototype = {
return true; return true;
}, },
_removeEffect : function(list, actor) {
let idx = list.indexOf(actor);
if (idx != -1) {
list.splice(idx, 1);
return true;
}
return false;
},
_minimizeWindow : function(actor) { _minimizeWindow : function(actor) {
if (!this._shouldAnimate(actor)) { if (!this._shouldAnimate(actor)) {
this._shellwm.completed_minimize(actor); this._shellwm.completed_minimize(actor);
@ -107,19 +116,26 @@ WindowManager.prototype = {
transition: "easeOutQuad", transition: "easeOutQuad",
onComplete: this._minimizeWindowDone, onComplete: this._minimizeWindowDone,
onCompleteScope: this, onCompleteScope: this,
onCompleteParams: [actor] onCompleteParams: [actor],
onOverwrite: this._minimizeWindowOverwritten,
onOverwriteScope: this,
onOverwriteParams: [actor]
}); });
}, },
_minimizeWindowDone : function(actor) { _minimizeWindowDone : function(actor) {
let idx = this._minimizing.indexOf(actor); if (this._removeEffect(this._minimizing, actor)) {
if (idx != -1) {
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
actor.set_scale(1.0, 1.0); actor.set_scale(1.0, 1.0);
actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST); actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST);
this._shellwm.completed_minimize(actor);
this._minimizing.splice(idx, 1); this._shellwm.completed_minimize(actor);
}
},
_minimizeWindowOverwritten : function(actor) {
if (this._removeEffect(this._minimizing, actor)) {
this._shellwm.completed_minimize(actor);
} }
}, },
@ -148,19 +164,25 @@ WindowManager.prototype = {
transition: "easeOutQuad", transition: "easeOutQuad",
onComplete: this._maximizeWindowDone, onComplete: this._maximizeWindowDone,
onCompleteScope: this, onCompleteScope: this,
onCompleteParams: [actor] onCompleteParams: [actor],
onOverwrite: this._maximizeWindowOverwrite,
onOverwriteScope: this,
onOverwriteParams: [actor]
}); });
}, },
_maximizeWindowDone : function(actor) { _maximizeWindowDone : function(actor) {
let idx = this._maximizing.indexOf(actor); if (this._removeEffect(this._maximizing, actor)) {
if (idx != -1) {
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
actor.set_scale(1.0, 1.0); actor.set_scale(1.0, 1.0);
actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST); actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST);
this._shellwm.completed_maximize(actor); this._shellwm.completed_maximize(actor);
}
},
this._maximizing.splice(idx, 1); _maximizeWindowOverwrite : function(actor) {
if (this._removeEffect(this._maximizing, actor)) {
this._shellwm.completed_maximize(actor);
} }
}, },
@ -190,19 +212,25 @@ WindowManager.prototype = {
transition: "easeOutQuad", transition: "easeOutQuad",
onComplete: this._mapWindowDone, onComplete: this._mapWindowDone,
onCompleteScope: this, onCompleteScope: this,
onCompleteParams: [actor] onCompleteParams: [actor],
onOverwrite: this._mapWindowOverwrite,
onOverwriteScope: this,
onOverwriteParams: [actor]
}); });
}, },
_mapWindowDone : function(actor) { _mapWindowDone : function(actor) {
let idx = this._mapping.indexOf(actor); if (this._removeEffect(this._mapping, actor)) {
if (idx != -1) {
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
actor.set_scale(1.0, 1.0); actor.set_scale(1.0, 1.0);
actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST); actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST);
this._shellwm.completed_map(actor); this._shellwm.completed_map(actor);
}
},
this._mapping.splice(idx, 1); _mapWindowOverwrite : function(actor) {
if (this._removeEffect(this._mapping, actor)) {
this._shellwm.completed_map(actor);
} }
}, },
@ -223,18 +251,24 @@ WindowManager.prototype = {
transition: "easeOutQuad", transition: "easeOutQuad",
onComplete: this._destroyWindowDone, onComplete: this._destroyWindowDone,
onCompleteScope: this, onCompleteScope: this,
onCompleteParams: [actor] onCompleteParams: [actor],
onOverwrite: this._destroyWindowOverwrite,
onOverwriteScope: this,
onOverwriteParams: [actor]
}); });
}, },
_destroyWindowDone : function(actor) { _destroyWindowDone : function(actor) {
let idx = this._destroying.indexOf(actor); if (this._removeEffect(this._destroying, actor)) {
if (idx != -1) {
this._shellwm.completed_destroy(actor); this._shellwm.completed_destroy(actor);
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
actor.set_scale(1.0, 1.0); actor.set_scale(1.0, 1.0);
}
},
this._mapping.splice(idx, 1); _destroyWindowOverwrite : function(actor) {
if (this._removeEffect(this._destroying, actor)) {
this._shellwm.completed_destroy(actor);
} }
}, },