[gnome-shell] WindowManager: clean up effects code
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] WindowManager: clean up effects code
- Date: Sun, 16 Dec 2012 19:46:51 +0000 (UTC)
commit 3b8a125732a7ad743903d5676af549b0a210d6b4
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sat Dec 15 03:23:36 2012 +0100
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
js/ui/windowManager.js | 93 +++++++++++++++++++++++++-----------------------
1 files changed, 48 insertions(+), 45 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 6dd4735..f596628 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -219,7 +219,9 @@ const WindowManager = new Lang.Class({
_shouldAnimateActor: function(actor) {
if (!this._shouldAnimate())
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) {
@@ -369,51 +371,49 @@ const WindowManager = new Lang.Class({
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)) {
shellwm.completed_map(actor);
return;
}
- actor.opacity = 0;
- actor.show();
+ if (actor.meta_window.is_attached_dialog()) {
+ /* 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 */
- 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]
- });
+ 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]
+ });
+ } 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) {
@@ -441,18 +441,21 @@ const WindowManager = new Lang.Class({
return win != window;
});
}
+
+ if (!this._shouldAnimateActor(actor)) {
+ shellwm.completed_destroy(actor);
+ return;
+ }
+
+ this._destroying.push(actor);
+
if (window.is_attached_dialog()) {
let parent = window.get_transient_for();
this._checkDimming(parent, window);
- if (!this._shouldAnimate()) {
- shellwm.completed_destroy(actor);
- return;
- }
actor.set_scale(1.0, 1.0);
actor.scale_gravity = Clutter.Gravity.CENTER;
actor.show();
- this._destroying.push(actor);
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
Tweener.removeTweens(actor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]