xwindow: ungrab before grabbing

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-10-02 16:10:50 +02:00
parent 62f0e62d5e
commit af654a75d2
1 changed files with 6 additions and 0 deletions

View File

@ -104,6 +104,9 @@ xwindow_configure(xcb_window_t win, area_t geometry, int border)
void void
xwindow_buttons_grab(xcb_window_t win, button_array_t *buttons) xwindow_buttons_grab(xcb_window_t win, button_array_t *buttons)
{ {
/* Ungrab everything first */
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, win, XCB_BUTTON_MASK_ANY);
foreach(b, *buttons) foreach(b, *buttons)
xcb_grab_button(globalconf.connection, false, win, BUTTONMASK, xcb_grab_button(globalconf.connection, false, win, BUTTONMASK,
XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE,
@ -136,6 +139,9 @@ xwindow_grabkey(xcb_window_t win, keyb_t *k)
void void
xwindow_grabkeys(xcb_window_t win, key_array_t *keys) xwindow_grabkeys(xcb_window_t win, key_array_t *keys)
{ {
/* Ungrab everything first */
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, win, XCB_BUTTON_MASK_ANY);
foreach(k, *keys) foreach(k, *keys)
xwindow_grabkey(win, *k); xwindow_grabkey(win, *k);
} }