]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Don’t change to workspaces on different screens when scrolling through them...
authorMichael Stapelberg <michael+x200@stapelberg.de>
Sat, 11 Apr 2009 09:54:30 +0000 (11:54 +0200)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Sat, 11 Apr 2009 09:54:30 +0000 (11:54 +0200)
This fixes ticket #19

src/handlers.c

index 477666236c2053f11954d6abc91f51fa3e797ec5..caf08bf0c9e728bdde1fa863a462f33e0cc04295 100644 (file)
@@ -252,11 +252,12 @@ static bool button_press_bar(xcb_connection_t *conn, xcb_button_press_event_t *e
 
                 /* Check if the button was one of button4 or button5 (scroll up / scroll down) */
                 if (event->detail == XCB_BUTTON_INDEX_4 || event->detail == XCB_BUTTON_INDEX_5) {
-                        int dest_workspace = (event->detail == XCB_BUTTON_INDEX_4 ?
-                                              c_ws->num - 1 :
-                                              c_ws->num + 1);
-                        if ((dest_workspace >= 0) && (dest_workspace < 10))
-                                show_workspace(conn, dest_workspace+1);
+                        int add = (event->detail == XCB_BUTTON_INDEX_4 ? -1 : 1);
+                        for (int i = c_ws->num + add; (i >= 0) && (i < 10); i += add)
+                                if (workspaces[i].screen == screen) {
+                                        show_workspace(conn, i+1);
+                                        return true;
+                                }
                         return true;
                 }
                 i3Font *font = load_font(conn, config.font);