[gnome-shell/T29763: 45/249] windowManager: implement Endless animations



commit 72afb8194ecd9e4d3bf5b9a333c3b5a9f23239f3
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.
    
     * 2020-03-16: Trivial rebase conflicts, code style cleanups
    
    https://phabricator.endlessm.com/T17526

 js/ui/windowManager.js | 111 +++++++++++++++++++++----------------------------
 1 file changed, 48 insertions(+), 63 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 91e10e157e..c26d1e1ef6 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;
@@ -857,6 +858,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);
@@ -1466,34 +1468,12 @@ var WindowManager = class {
                 onStopped: () => this._minimizeWindowDone(shellwm, actor),
             });
         } 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: () => this._minimizeWindowDone(shellwm, actor),
             });
         }
@@ -1514,7 +1494,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;
         }
@@ -1531,33 +1513,14 @@ var WindowManager = class {
                 onStopped: () => this._unminimizeWindowDone(shellwm, actor),
             });
         } 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,
+                y: rect.y,
                 duration: MINIMIZE_WINDOW_ANIMATION_TIME,
                 mode: Clutter.AnimationMode.EASE_IN_EXPO,
                 onStopped: () => this._unminimizeWindowDone(shellwm, actor),
@@ -1886,21 +1849,43 @@ 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.add(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.add(actor);
 
-            actor.ease({
-                opacity: 255,
-                scale_x: 1,
-                scale_y: 1,
-                duration: SHOW_WINDOW_ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_OUT_EXPO,
-                onStopped: () => this._mapWindowDone(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: () => this._mapWindowDone(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.add(actor);
+
+                actor.ease({
+                    opacity: 255,
+                    scale_x: 1,
+                    scale_y: 1,
+                    duration: SHOW_WINDOW_ANIMATION_TIME,
+                    mode: Clutter.AnimationMode.EASE_OUT_EXPO,
+                    onStopped: () => this._mapWindowDone(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]