Fix clicking on workspaces in internal bar (with named workspaces) (Thanks bapt)
This commit is contained in:
parent
1aeaa153e5
commit
4c373c2128
|
@ -276,16 +276,22 @@ static bool button_press_bar(xcb_connection_t *conn, xcb_button_press_event_t *e
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
i3Font *font = load_font(conn, config.font);
|
int drawn = 0;
|
||||||
int workspace = event->event_x / (font->height + 6),
|
|
||||||
c = 0;
|
|
||||||
/* Because workspaces can be on different screens, we need to loop
|
/* Because workspaces can be on different screens, we need to loop
|
||||||
through all of them and decide to count it based on its ->screen */
|
through all of them and decide to count it based on its ->screen */
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++) {
|
||||||
if ((workspaces[i].screen == screen) && (c++ == workspace)) {
|
if (workspaces[i].screen != screen)
|
||||||
|
continue;
|
||||||
|
LOG("Checking if click was on workspace %d with drawn = %d, tw = %d\n",
|
||||||
|
i, drawn, workspaces[i].text_width);
|
||||||
|
if (event->event_x > (drawn + 1) &&
|
||||||
|
event->event_x <= (drawn + 1 + workspaces[i].text_width + 5 + 5)) {
|
||||||
show_workspace(conn, i+1);
|
show_workspace(conn, i+1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawn += workspaces[i].text_width + 5 + 5 + 2;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue