windowManager: Fix switch animation between non-adjacent workspaces

Commit e5c95b910d refactored the workspace animation to also handle
animations that involve all surrounding workspaces, but due to an
ill-advised review comment (guess whose) it broke the animation
for non-neighboring workspaces.

Update the code to handle correctly whether in a given direction:
 - we have the target workspace of a given index
 - we have a neighboring workspace
 - we don't need to animate anything

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/182
This commit is contained in:
Florian Müllner 2018-07-31 06:37:20 +02:00
parent 2991f9f102
commit 91da3789bc

View File

@ -1856,8 +1856,14 @@ var WindowManager = new Lang.Class({
let curWs = workspaceManager.get_workspace_by_index (from);
for (let dir of Object.values(Meta.MotionDirection)) {
let ws = curWs.get_neighbor(dir);
if (ws == curWs || (to >= 0 && ws.index() != to)) {
let ws = null;
if (to < 0)
ws = curWs.get_neighbor(dir);
else if (dir == direction)
ws = workspaceManager.get_workspace_by_index(to);
if (ws == null || ws == curWs) {
switchData.surroundings[dir] = null;
continue;
}