Allow mouse bindings to run on the root window.

Previously, mouse bindings could only be run when a window was present,
by using --whole-window. Such bindings would not work on empty
workspaces. However, this is a valid usecase for bindings like

    bindsym $mod+button4 workspace prev
    bindsym $mod+button5 workspace next

Hence, we need to grab the root window as well and run bindings on it.

fixes #2097
This commit is contained in:
Ingo Bürk
2015-12-12 15:45:59 -05:00
parent 8e081d7fff
commit 6f12f029f4
2 changed files with 19 additions and 0 deletions

View File

@ -164,6 +164,10 @@ void regrab_all_buttons(xcb_connection_t *conn) {
xcb_grab_buttons(conn, con->window->id, grab_scrollwheel);
}
/* Also grab the root window to allow bindings to work on there as well. */
xcb_ungrab_button(conn, XCB_BUTTON_INDEX_ANY, root, XCB_BUTTON_MASK_ANY);
xcb_grab_buttons(conn, root, grab_scrollwheel);
xcb_ungrab_server(conn);
}