[gnome-shell/T27795: 59/138] windowManager: implement Endless animations



commit 0066c2fe0b39df1ce0114635038222d51751bea2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jun 9 13:55:59 2017 -0300

    windowManager: implement Endless animations
    
    The new animations make windows minimize and unminimize from
    the bottom of the screen, as well as making the Speedwagon
    windows animate from the bottom of the screen when they're
    mapped.
    
    https://phabricator.endlessm.com/T17526

 js/ui/windowManager.js | 125 +++++++++++++++++++++++--------------------------
 1 file changed, 58 insertions(+), 67 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 58707c155a..f1c2814667 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -26,7 +26,8 @@ const BackgroundMenu = imports.ui.backgroundMenu;
 const { loadInterfaceXML } = imports.misc.fileUtils;
 
 var SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
-var MINIMIZE_WINDOW_ANIMATION_TIME = 200;
+var MINIMIZE_WINDOW_ANIMATION_TIME = 250;
+var SHOW_SPEEDWAGON_ANIMATION_TIME = 300;
 var SHOW_WINDOW_ANIMATION_TIME = 150;
 var DIALOG_SHOW_WINDOW_ANIMATION_TIME = 100;
 var DESTROY_WINDOW_ANIMATION_TIME = 150;
@@ -997,6 +998,7 @@ var WindowManager = class {
         });
         this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
             this._minimizeWindowDone(shellwm, actor);
+            this._unminimizeWindowDone(shellwm, actor);
             this._mapWindowDone(shellwm, actor);
             this._destroyWindowDone(shellwm, actor);
             this._sizeChangeWindowDone(shellwm, actor);
@@ -1609,34 +1611,12 @@ var WindowManager = class {
                 }
             });
         } else {
-            let xDest, yDest, xScale, yScale;
-            let [success, geom] = actor.meta_window.get_icon_geometry();
-            if (success) {
-                xDest = geom.x;
-                yDest = geom.y;
-                xScale = geom.width / actor.width;
-                yScale = geom.height / actor.height;
-            } else {
-                let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
-                if (!monitor) {
-                    this._minimizeWindowDone();
-                    return;
-                }
-                xDest = monitor.x;
-                yDest = monitor.y;
-                if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-                    xDest += monitor.width;
-                xScale = 0;
-                yScale = 0;
-            }
+            let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
 
             actor.ease({
-                scale_x: xScale,
-                scale_y: yScale,
-                x: xDest,
-                y: yDest,
+                y: monitor.y + monitor.height,
                 duration: MINIMIZE_WINDOW_ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_IN_EXPO,
+                mode: Clutter.AnimationMode.EASE_OUT_QUAD,
                 onStopped: isFinished => {
                     if (isFinished)
                         this._minimizeWindowDone(shellwm, actor);
@@ -1668,7 +1648,9 @@ var WindowManager = class {
         let types = [Meta.WindowType.NORMAL,
                      Meta.WindowType.MODAL_DIALOG,
                      Meta.WindowType.DIALOG];
-        if (!this._shouldAnimateActor(actor, types)) {
+
+        // If the overview is visible, we will handle the animation here.
+        if (!this._shouldAnimateActor(actor, types) && !Main.overview.visible) {
             shellwm.completed_unminimize(actor);
             return;
         }
@@ -1690,35 +1672,17 @@ var WindowManager = class {
                 }
             });
         } else {
-            let [success, geom] = actor.meta_window.get_icon_geometry();
-            if (success) {
-                actor.set_position(geom.x, geom.y);
-                actor.set_scale(geom.width / actor.width,
-                                geom.height / actor.height);
-            } else {
-                let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
-                if (!monitor) {
-                    actor.show();
-                    this._unminimizeWindowDone();
-                    return;
-                }
-                actor.set_position(monitor.x, monitor.y);
-                if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-                    actor.x += monitor.width;
-                actor.set_scale(0, 0);
-            }
+            let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
+            actor.set_position(actor.x, monitor.y + monitor.height);
 
             let rect = actor.meta_window.get_frame_rect();
             let [xDest, yDest] = [rect.x, rect.y];
 
             actor.show();
             actor.ease({
-                scale_x: 1,
-                scale_y: 1,
-                x: xDest,
                 y: yDest,
                 duration: MINIMIZE_WINDOW_ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_IN_EXPO,
+                mode: Clutter.AnimationMode.EASE_OUT_QUAD,
                 onStopped: isFinished => {
                     if (isFinished)
                         this._unminimizeWindowDone(shellwm, actor);
@@ -2060,26 +2024,53 @@ var WindowManager = class {
 
         switch (actor._windowType) {
         case Meta.WindowType.NORMAL:
-            actor.set_pivot_point(0.5, 1.0);
-            actor.scale_x = 0.01;
-            actor.scale_y = 0.05;
-            actor.opacity = 0;
-            actor.show();
-            this._mapping.push(actor);
+            // Speedwagon windows slide from the bottom, while regular
+            // windows just fade in. Regular windows with a Speedwagon
+            // splash were already special-cased before reaching here.
+            if (isSplashWindow) {
+                let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
+                actor.x = monitor.x;
+                actor.y = monitor.y + monitor.height;
+                actor.show();
+                this._mapping.push(actor);
 
-            actor.ease({
-                opacity: 255,
-                scale_x: 1,
-                scale_y: 1,
-                duration: SHOW_WINDOW_ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_OUT_EXPO,
-                onStopped: isFinished => {
-                    if (isFinished)
-                        this._mapWindowDone(shellwm, actor);
-                    else
-                        this._mapWindowOverwrite(shellwm, actor);
-                }
-            });
+                actor.ease({
+                    opacity: 255,
+                    x: monitor.x,
+                    y: monitor.y,
+                    scale_x: 1,
+                    scale_y: 1,
+                    duration: SHOW_SPEEDWAGON_ANIMATION_TIME,
+                    mode: Clutter.AnimationMode.LINEAR,
+                    onStopped: isFinished => {
+                        if (isFinished)
+                            this._mapWindowDone(shellwm, actor);
+                        else
+                            this._mapWindowOverwrite(shellwm, actor);
+                    }
+                });
+            } else {
+                actor.set_pivot_point(0.5, 1.0);
+                actor.scale_x = 0.01;
+                actor.scale_y = 0.05;
+                actor.opacity = 0;
+                actor.show();
+                this._mapping.push(actor);
+
+                actor.ease({
+                    opacity: 255,
+                    scale_x: 1,
+                    scale_y: 1,
+                    duration: SHOW_WINDOW_ANIMATION_TIME,
+                    mode: Clutter.AnimationMode.EASE_OUT_EXPO,
+                    onStopped: isFinished => {
+                        if (isFinished)
+                            this._mapWindowDone(shellwm, actor);
+                        else
+                            this._mapWindowOverwrite(shellwm, actor);
+                    }
+                });
+            }
             break;
         case Meta.WindowType.MODAL_DIALOG:
         case Meta.WindowType.DIALOG:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]