I am grabbing keys with xcb_grab_key_checked
:
xcb_void_cookie_t grabc = xcb_grab_key_checked(connection, 1, rootwin, grabmodflag, keycode, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_generic_error_t *grabe = xcb_request_check(connection, grabc);
if (grabe == NULL) debug_log("succeessfully grabbed");
And to ungrab all these keys I use xcb_ungrab_keyboard_checked
:
xcb_void_cookie_t ungrabc = xcb_ungrab_keyboard_checked(connection, XCB_CURRENT_TIME);
xcb_generic_error_t* ungrabe = xcb_request_check(connection, ungrabc);
if (ungrabe == NULL) debug_log("succesfully ungrabbed");
However it doesnt seem to ungrab the keys. Is this by design?
Yes it is by design. Grabbing a key and grabbing the keyboard are rather different operations. Grabbing the keyboard doesn't mean grabbing all keys.
Grabbing a key is, in fact, making that key initiate a keyboard grab. Key grabs are normally used to implement hotkeys. A keyboard grab diverts all key events to the client. Keyboard grabs are transient (tjey last e.g. while a pop-up menu is shown) and key grabs are long term (hotkeys are rarely changed).