[gnome-shell] windowManager: Respect icon geometry when minimizing



commit 89a49ce72e1be10867579ad245bd128fb905f12b
Author: Florian MÃllner <fmuellner gnome org>
Date:   Mon Jan 21 22:21:08 2013 +0100

    windowManager: Respect icon geometry when minimizing
    
    When using a dock or window-list with the shell, it makes sense for
    us to minimize to the location requested rather than the activities
    button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692997

 js/ui/windowManager.js |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 35b6799..2b1af8f 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -242,22 +242,30 @@ const WindowManager = new Lang.Class({
         }
 
         actor.set_scale(1.0, 1.0);
-        actor.move_anchor_point_from_gravity(Clutter.Gravity.CENTER);
 
-        /* scale window down to 0x0.
-         * maybe TODO: get icon geometry passed through and move the window towards it?
-         */
         this._minimizing.push(actor);
 
-        let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
-        let xDest = monitor.x;
-        let yDest = monitor.y;
-        if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-            xDest += monitor.width;
+        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 {
+            /* scale window down to 0x0.  */
+            let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
+            xDest = monitor.x;
+            yDest = monitor.y;
+            xScale = 0.0;
+            yScale = 0.0;
+            if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
+                xDest += monitor.width;
+        }
 
         Tweener.addTween(actor,
-                         { scale_x: 0.0,
-                           scale_y: 0.0,
+                         { scale_x: xScale,
+                           scale_y: yScale,
                            x: xDest,
                            y: yDest,
                            time: WINDOW_ANIMATION_TIME,



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