From e3516d72f59ffaf9c71ab117168b44cd9b7f6422 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 11 Apr 2009 11:54:30 +0200 Subject: [PATCH] =?utf8?q?Bugfix:=20Don=E2=80=99t=20change=20to=20workspac?= =?utf8?q?es=20on=20different=20screens=20when=20scrolling=20through=20the?= =?utf8?q?m=20(Thanks=20Mirko)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes ticket #19 --- src/handlers.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index 47766623..caf08bf0 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -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); -- 2.39.5