[gnome-shell] windowManager: Fix fullscreen windows in ws switching animations



commit 4e6b2eb72a0920c534845fe789dfeecd0cb90295
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri May 3 22:56:02 2019 +0200

    windowManager: Fix fullscreen windows in ws switching animations
    
    To prevent a small gap between windows in the workspace switching
    animation, we temporarily shift windows up or down by the height of the
    panel. This obviously breaks the animation for fullscreen windows, those
    will overlap with the ones on the other workspace since there is no
    panel shown in that case.
    
    Fix this by checking whether the old or new workspace includes a
    fullscreen window and don't shift the windows if there is one.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/757
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/322

 js/ui/windowManager.js | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index b9f5fef46..e80cfd483 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1870,17 +1870,25 @@ var WindowManager = class {
         }
     }
 
-    _getPositionForDirection(direction) {
+    _getPositionForDirection(direction, fromWs, toWs) {
         let xDest = 0, yDest = 0;
 
+        let oldWsIsFullscreen = fromWs.list_windows().some(w => w.is_fullscreen());
+        let newWsIsFullscreen = toWs.list_windows().some(w => w.is_fullscreen());
+
+        // We have to shift windows up or down by the height of the panel to prevent having a
+        // visible gap between the windows while switching workspaces. Since fullscreen windows
+        // hide the panel, they don't need to be shifted up or down.
+        let shiftHeight = Main.panel.height;
+
         if (direction == Meta.MotionDirection.UP ||
             direction == Meta.MotionDirection.UP_LEFT ||
             direction == Meta.MotionDirection.UP_RIGHT)
-            yDest = -global.screen_height + Main.panel.height;
+            yDest = -global.screen_height + (oldWsIsFullscreen ? 0 : shiftHeight);
         else if (direction == Meta.MotionDirection.DOWN ||
             direction == Meta.MotionDirection.DOWN_LEFT ||
             direction == Meta.MotionDirection.DOWN_RIGHT)
-            yDest = global.screen_height - Main.panel.height;
+            yDest = global.screen_height - (newWsIsFullscreen ? 0 : shiftHeight);
 
         if (direction == Meta.MotionDirection.LEFT ||
             direction == Meta.MotionDirection.UP_LEFT ||
@@ -1938,7 +1946,7 @@ var WindowManager = class {
             switchData.container.add_actor(info.actor);
             info.actor.raise_top();
 
-            let [x, y] = this._getPositionForDirection(dir);
+            let [x, y] = this._getPositionForDirection(dir, curWs, ws);
             info.actor.set_position(x, y);
         }
 
@@ -2024,7 +2032,11 @@ var WindowManager = class {
 
         this._switchData.inProgress = true;
 
-        let [xDest, yDest] = this._getPositionForDirection(direction);
+        let workspaceManager = global.workspace_manager;
+        let fromWs = workspaceManager.get_workspace_by_index(from);
+        let toWs = workspaceManager.get_workspace_by_index(to);
+
+        let [xDest, yDest] = this._getPositionForDirection(direction, fromWs, toWs);
 
         /* @direction is the direction that the "camera" moves, so the
          * screen contents have to move one screen's worth in the


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