]> git.sur5r.net Git - i3/i3/commitdiff
Allow using left/right scrolling like up/down scrolling. 2680/head
authorIngo Bürk <ingo.buerk@tngtech.com>
Sun, 12 Feb 2017 19:48:44 +0000 (20:48 +0100)
committerIngo Bürk <ingo.buerk@tngtech.com>
Tue, 14 Feb 2017 21:28:01 +0000 (22:28 +0100)
This commit makes left/right scrolling synonyms for up/down scrolling for
* scrolling on window decoration
* scrolling on i3bar workspaces

fixes #2677

i3bar/src/xcb.c
include/libi3.h
src/click.c

index 0b9d6f81d33710aae9df9440cb1ffdd77ed4e241..24f91642d3945f16ef3fde27cd81fa05eb69d93f 100644 (file)
@@ -532,6 +532,7 @@ void handle_button(xcb_button_press_event_t *event) {
     }
     switch (event->detail) {
         case XCB_BUTTON_SCROLL_UP:
+        case XCB_BUTTON_SCROLL_LEFT:
             /* Mouse wheel up. We select the previous ws, if any.
              * If there is no more workspace, don’t even send the workspace
              * command, otherwise (with workspace auto_back_and_forth) we’d end
@@ -542,6 +543,7 @@ void handle_button(xcb_button_press_event_t *event) {
             cur_ws = TAILQ_PREV(cur_ws, ws_head, tailq);
             break;
         case XCB_BUTTON_SCROLL_DOWN:
+        case XCB_BUTTON_SCROLL_RIGHT:
             /* Mouse wheel down. We select the next ws, if any.
              * If there is no more workspace, don’t even send the workspace
              * command, otherwise (with workspace auto_back_and_forth) we’d end
index 67094534f6af5ec86bf5fc94e8ae7207b38b9ab3..dbb29e1f79b587ba7395db436e3f8b8b48cfdcd6 100644 (file)
@@ -34,7 +34,6 @@
 #define XCB_BUTTON_SCROLL_LEFT 6
 #define XCB_BUTTON_SCROLL_RIGHT 7
 
-
 /**
  * XCB connection and root screen
  *
index 5717b9b0d03d1ea5af29ed9cad16c7764f7a33a4..e989b88d987aa15877e565e9e743e991b0367cca 100644 (file)
@@ -229,7 +229,9 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
     if (in_stacked &&
         dest == CLICK_DECORATION &&
         (event->detail == XCB_BUTTON_SCROLL_UP ||
-         event->detail == XCB_BUTTON_SCROLL_DOWN)) {
+         event->detail == XCB_BUTTON_SCROLL_DOWN ||
+         event->detail == XCB_BUTTON_SCROLL_LEFT ||
+         event->detail == XCB_BUTTON_SCROLL_RIGHT)) {
         DLOG("Scrolling on a window decoration\n");
         orientation_t orientation = (con->parent->layout == L_STACKED ? VERT : HORIZ);
         /* Focus the currently focused container on the same level that the
@@ -244,10 +246,12 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
          * #557), we first check if scrolling is possible at all. */
         bool scroll_prev_possible = (TAILQ_PREV(focused, nodes_head, nodes) != NULL);
         bool scroll_next_possible = (TAILQ_NEXT(focused, nodes) != NULL);
-        if (event->detail == XCB_BUTTON_SCROLL_UP && scroll_prev_possible)
+        if ((event->detail == XCB_BUTTON_SCROLL_UP || event->detail == XCB_BUTTON_SCROLL_LEFT) && scroll_prev_possible) {
             tree_next('p', orientation);
-        else if (event->detail == XCB_BUTTON_SCROLL_DOWN && scroll_next_possible)
+        } else if ((event->detail == XCB_BUTTON_SCROLL_DOWN || event->detail == XCB_BUTTON_SCROLL_RIGHT) && scroll_next_possible) {
             tree_next('n', orientation);
+        }
+
         goto done;
     }