Commit 4e6b2eb7 authored by verdre's avatar verdre Committed by Florian Müllner

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 #757

!322
parent 2e5295b3
Pipeline #79567 passed with stages
in 3 minutes and 32 seconds
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment