[gnome-shell] workspacesView/workspacesDisplay: Scroll on horizontal layouts



commit cffad8b749dd1705ba6278ed0422f690d0ccd7ff
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jan 2 17:56:57 2021 -0300

    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>

 js/ui/workspacesView.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 12f5ca3a81..8fc21c40df 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -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);


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