Clicking the root window should try to focus the relevant workspace.

next
Deiz 2012-09-23 10:35:52 -04:00 committed by Michael Stapelberg
parent a080794e59
commit e582e19ffd
2 changed files with 20 additions and 0 deletions

View File

@ -309,6 +309,25 @@ int handle_button_press(xcb_button_press_event_t *event) {
return route_click(con, event, mod_pressed, CLICK_INSIDE);
if (!(con = con_by_frame_id(event->event))) {
/* If the root window is clicked, find the relevant output from the
* click coordinates and focus the output's active workspace. */
if (event->event == root) {
Con *output, *ws;
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
if (con_is_internal(output) ||
!rect_contains(output->rect, event->event_x, event->event_y))
continue;
ws = TAILQ_FIRST(&(output_get_content(output)->focus_head));
if (ws != con_get_workspace(focused)) {
workspace_show(ws);
tree_render();
}
return 1;
}
return 0;
}
ELOG("Clicked into unknown window?!\n");
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
xcb_flush(conn);

View File

@ -544,6 +544,7 @@ int main(int argc, char *argv[]) {
uint32_t mask = XCB_CW_EVENT_MASK;
uint32_t values[] = { XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video
projector), the root window gets a
ConfigureNotify */