[gnome-shell/wip/jimmac/dash-icon-spacing: 45/72] workspacesView/workspacesDisplay: Scroll on horizontal layouts




commit cf36c54a688638bda8ec587d978e58b5e7937ac9
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.

 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 2023425195..fa2d31d828 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -880,14 +880,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]