workspacesView/workspacesDisplay: Scroll on horizontal layouts

WokspacesDisplay simply remaps the scroll direction into the next
workspace, but that doesn't account for the new horizontal layout.

Scroll horizontally on horizontal layouts when scroll direction is
on the vertical axis.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1603>
This commit is contained in:
Georges Basile Stavracas Neto 2021-01-02 17:56:57 -03:00 committed by Marge Bot
parent 0882074ecc
commit cffad8b749

View File

@ -772,14 +772,21 @@ class WorkspacesDisplay extends St.Widget {
return Clutter.EVENT_PROPAGATE;
let workspaceManager = global.workspace_manager;
const vertical = workspaceManager.layout_rows === -1;
let activeWs = workspaceManager.get_active_workspace();
let ws;
switch (event.get_scroll_direction()) {
case Clutter.ScrollDirection.UP:
ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
if (vertical)
ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
else
ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
break;
case Clutter.ScrollDirection.DOWN:
ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
if (vertical)
ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
else
ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
break;
case Clutter.ScrollDirection.LEFT:
ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);