[gnome-shell/wip/abono/maximize: 1/4] windowManager: Generalize translation values



commit 32fd3e3f0c7626e18044e8092c4e457068221569
Author: Alessandro Bono <abono gnome org>
Date:   Sat May 20 16:34:35 2017 +0200

    windowManager: Generalize translation values
    
    Currently, the translation values are setted with the assumption
    that one of the actors (actor or actorClone) represents a
    fullscreen window. In order to generalize it, we work with the
    following assumptions:
    - sourceRect (associated with the actor 'actorClone') is from
      where the window is moving
    - targetRect (associated with the actor 'actor') is to where the
      window is moving
    - actorClone visually represents the window before the change
    - actor visually represents the window after the change
    
    What we want is move the two actors from sourceRect to targetRect
    with a crossfade effect (i.e., actorClone gradually becomes
    invisible). Thus, we need to move/translate/scale them accordly.
    The animation of 'actorClone' is already general enough, while the
    animation of 'actor' isn't. To generalize it, we translate 'actor'
    in each dimension about the difference between targetRect and
    sourceRect (e.g., targetRect.x - sourceRect.x).
    If the difference is positive, it means that sourceRect is on the
    left of targetRect (or above targetRect, if we are looking at y
    values), therefore, we need a negative value to translate 'actor'
    to the left (or up). On the other hand, if the difference is negative,
    it means that sourceRect is on the right (or down), therefore we need
    a positive value to translate 'actor' on the right (or down).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766685

 js/ui/windowManager.js |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index b987467..944ab67 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1331,13 +1331,11 @@ const WindowManager = new Lang.Class({
         actorClone.set_size(oldFrameRect.width, oldFrameRect.height);
         Main.uiGroup.add_actor(actorClone);
 
-        let rect = change == Meta.SizeChange.FULLSCREEN ? oldFrameRect : null;
-
         if (this._clearFullscreenInfo(actor))
             this._shellwm.completed_size_change(actor);
 
         actor.__fullscreenInfo = { clone: actorClone,
-                                   oldRect: rect };
+                                   oldRect: oldFrameRect };
     },
 
     _sizeChangedWindow: function(shellwm, actor) {
@@ -1365,15 +1363,9 @@ const WindowManager = new Lang.Class({
                            transition: 'easeOutQuad'
                          });
 
-        let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
         let sourceRect = actor.__fullscreenInfo.oldRect;
-        if (sourceRect) {
-            actor.translation_x = sourceRect.x - monitor.x;
-            actor.translation_y = sourceRect.y - monitor.y;
-        } else {
-            actor.translation_x = -(targetRect.x - monitor.x);
-            actor.translation_y = -(targetRect.y - monitor.y);
-        }
+        actor.translation_x = -(targetRect.x - sourceRect.x);
+        actor.translation_y = -(targetRect.y - sourceRect.y);
 
         // Now set scale the actor to size it as the clone.
         actor.scale_x = 1 / scaleX;


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