WindowManager: clean up effects code
Use consistently shouldAnimateActor(), and try to have a uniform code flow between the modal dialog and the normal case. https://bugzilla.gnome.org/show_bug.cgi?id=690241
This commit is contained in:
parent
9860b1c677
commit
3b8a125732
@ -219,7 +219,9 @@ const WindowManager = new Lang.Class({
|
|||||||
_shouldAnimateActor: function(actor) {
|
_shouldAnimateActor: function(actor) {
|
||||||
if (!this._shouldAnimate())
|
if (!this._shouldAnimate())
|
||||||
return false;
|
return false;
|
||||||
return actor.meta_window.get_window_type() == Meta.WindowType.NORMAL;
|
let windowType = actor.meta_window.get_window_type();
|
||||||
|
return windowType == Meta.WindowType.NORMAL ||
|
||||||
|
windowType == Meta.WindowType.MODAL_DIALOG;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeEffect : function(list, actor) {
|
_removeEffect : function(list, actor) {
|
||||||
@ -369,51 +371,49 @@ const WindowManager = new Lang.Class({
|
|||||||
|
|
||||||
actor._windowType = type;
|
actor._windowType = type;
|
||||||
}));
|
}));
|
||||||
if (actor.meta_window.is_attached_dialog()) {
|
|
||||||
this._checkDimming(actor.get_meta_window().get_transient_for());
|
|
||||||
if (this._shouldAnimate()) {
|
|
||||||
actor.set_scale(1.0, 0.0);
|
|
||||||
actor.scale_gravity = Clutter.Gravity.CENTER;
|
|
||||||
actor.show();
|
|
||||||
this._mapping.push(actor);
|
|
||||||
|
|
||||||
Tweener.addTween(actor,
|
|
||||||
{ scale_y: 1,
|
|
||||||
time: WINDOW_ANIMATION_TIME,
|
|
||||||
transition: "easeOutQuad",
|
|
||||||
onComplete: this._mapWindowDone,
|
|
||||||
onCompleteScope: this,
|
|
||||||
onCompleteParams: [shellwm, actor],
|
|
||||||
onOverwrite: this._mapWindowOverwrite,
|
|
||||||
onOverwriteScope: this,
|
|
||||||
onOverwriteParams: [shellwm, actor]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
shellwm.completed_map(actor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!this._shouldAnimateActor(actor)) {
|
if (!this._shouldAnimateActor(actor)) {
|
||||||
shellwm.completed_map(actor);
|
shellwm.completed_map(actor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
actor.opacity = 0;
|
if (actor.meta_window.is_attached_dialog()) {
|
||||||
actor.show();
|
/* Scale the window from the center of the parent */
|
||||||
|
this._checkDimming(actor.get_meta_window().get_transient_for());
|
||||||
|
actor.set_scale(1.0, 0.0);
|
||||||
|
actor.scale_gravity = Clutter.Gravity.CENTER;
|
||||||
|
actor.show();
|
||||||
|
this._mapping.push(actor);
|
||||||
|
|
||||||
/* Fade window in */
|
Tweener.addTween(actor,
|
||||||
this._mapping.push(actor);
|
{ scale_y: 1,
|
||||||
Tweener.addTween(actor,
|
time: WINDOW_ANIMATION_TIME,
|
||||||
{ opacity: 255,
|
transition: "easeOutQuad",
|
||||||
time: WINDOW_ANIMATION_TIME,
|
onComplete: this._mapWindowDone,
|
||||||
transition: 'easeOutQuad',
|
onCompleteScope: this,
|
||||||
onComplete: this._mapWindowDone,
|
onCompleteParams: [shellwm, actor],
|
||||||
onCompleteScope: this,
|
onOverwrite: this._mapWindowOverwrite,
|
||||||
onCompleteParams: [shellwm, actor],
|
onOverwriteScope: this,
|
||||||
onOverwrite: this._mapWindowOverwrite,
|
onOverwriteParams: [shellwm, actor]
|
||||||
onOverwriteScope: this,
|
});
|
||||||
onOverwriteParams: [shellwm, actor]
|
} else {
|
||||||
});
|
/* Fade window in */
|
||||||
|
actor.opacity = 0;
|
||||||
|
actor.show();
|
||||||
|
this._mapping.push(actor);
|
||||||
|
|
||||||
|
Tweener.addTween(actor,
|
||||||
|
{ opacity: 255,
|
||||||
|
time: WINDOW_ANIMATION_TIME,
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
onComplete: this._mapWindowDone,
|
||||||
|
onCompleteScope: this,
|
||||||
|
onCompleteParams: [shellwm, actor],
|
||||||
|
onOverwrite: this._mapWindowOverwrite,
|
||||||
|
onOverwriteScope: this,
|
||||||
|
onOverwriteParams: [shellwm, actor]
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mapWindowDone : function(shellwm, actor) {
|
_mapWindowDone : function(shellwm, actor) {
|
||||||
@ -441,18 +441,21 @@ const WindowManager = new Lang.Class({
|
|||||||
return win != window;
|
return win != window;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this._shouldAnimateActor(actor)) {
|
||||||
|
shellwm.completed_destroy(actor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._destroying.push(actor);
|
||||||
|
|
||||||
if (window.is_attached_dialog()) {
|
if (window.is_attached_dialog()) {
|
||||||
let parent = window.get_transient_for();
|
let parent = window.get_transient_for();
|
||||||
this._checkDimming(parent, window);
|
this._checkDimming(parent, window);
|
||||||
if (!this._shouldAnimate()) {
|
|
||||||
shellwm.completed_destroy(actor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
actor.set_scale(1.0, 1.0);
|
actor.set_scale(1.0, 1.0);
|
||||||
actor.scale_gravity = Clutter.Gravity.CENTER;
|
actor.scale_gravity = Clutter.Gravity.CENTER;
|
||||||
actor.show();
|
actor.show();
|
||||||
this._destroying.push(actor);
|
|
||||||
|
|
||||||
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
|
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
|
||||||
Tweener.removeTweens(actor);
|
Tweener.removeTweens(actor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user