[gnome-shell/gbsneto/40-stuff: 44/68] workspacesView/workspacesDisplay: Scroll on horizontal layouts




commit bda7e1bf31c57accf727d2efba66d901c9bc213a
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 372778cbda..dc2be6c012 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -871,14 +871,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]