WindowManager: improve destroy window animation

The animation is the same for modal dialogs, but it is now
run for non modal dialogs too (matching the new behavior on
show).
In addition, we run a destroy animation for normal windows,
if they use CSD (there are technical limitations that prevent
running animations after destroy on server decorated windows)

https://bugzilla.gnome.org/show_bug.cgi?id=732857
This commit is contained in:
Giovanni Campagna 2014-07-08 11:51:49 +02:00
parent eda27d5194
commit d4f0b5bdf3

View File

@ -1182,40 +1182,73 @@ const WindowManager = new Lang.Class({
}); });
} }
if (!this._shouldAnimateActor(actor, [Meta.WindowType.MODAL_DIALOG])) { let types = [Meta.WindowType.NORMAL,
Meta.WindowType.DIALOG,
Meta.WindowType.MODAL_DIALOG];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_destroy(actor); shellwm.completed_destroy(actor);
return; return;
} }
this._destroying.push(actor); switch (actor._windowType) {
case Meta.WindowType.NORMAL:
if (!window.is_client_decorated()) {
// We cannot animate the destruction of non-client
// decorated windows, because the frame window is
// repainted by the X server with the background pixmap/
// pixel before creating the last composite pixmap
// (so we animate a flat gray rectangle with a titlebar)
shellwm.completed_destroy(actor);
return;
}
if (window.is_attached_dialog()) {
let parent = window.get_transient_for();
this._checkDimming(parent, window);
actor.set_scale(1.0, 1.0);
actor.set_pivot_point(0.5, 0.5); actor.set_pivot_point(0.5, 0.5);
actor.show(); this._destroying.push(actor);
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () { Tweener.addTween(actor,
Tweener.removeTweens(actor); { opacity: 0,
this._destroyWindowDone(shellwm, actor); scale_x: 0.8,
})); scale_y: 0.8,
time: DESTROY_WINDOW_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._mapWindowDone,
onCompleteScope: this,
onCompleteParams: [shellwm, actor],
onOverwrite: this._mapWindowOverwrite,
onOverwriteScope: this,
onOverwriteParams: [shellwm, actor]
});
break;
case Meta.WindowType.MODAL_DIALOG:
case Meta.WindowType.DIALOG:
actor.set_pivot_point(0.5, 0.5);
this._destroying.push(actor);
if (window.is_attached_dialog()) {
let parent = window.get_transient_for();
this._checkDimming(parent, window);
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
Tweener.removeTweens(actor);
this._destroyWindowDone(shellwm, actor);
}));
}
Tweener.addTween(actor, Tweener.addTween(actor,
{ scale_y: 0, { scale_y: 0,
time: DESTROY_WINDOW_ANIMATION_TIME, time: DESTROY_WINDOW_ANIMATION_TIME,
transition: "easeOutQuad", transition: 'easeOutQuad',
onComplete: this._destroyWindowDone, onComplete: this._destoyWindowDone,
onCompleteScope: this, onCompleteScope: this,
onCompleteParams: [shellwm, actor], onCompleteParams: [shellwm, actor],
onOverwrite: this._destroyWindowDone, onOverwrite: this._destroyWindowDone,
onOverwriteScope: this, onOverwriteScope: this,
onOverwriteParams: [shellwm, actor] onOverwriteParams: [shellwm, actor]
}); });
break;
default:
shellwm.completed_destroy(actor);
return; return;
} }
shellwm.completed_destroy(actor);
}, },
_destroyWindowDone : function(shellwm, actor) { _destroyWindowDone : function(shellwm, actor) {