/* Grab the pointer */
xcb_grab_pointer_cookie_t cookie;
xcb_grab_pointer_reply_t *reply;
+ xcb_generic_error_t *error;
+
cookie = xcb_grab_pointer(conn,
false, /* get all pointer events specified by the following mask */
root, /* grab the root window */
xcursor, /* possibly display a special cursor */
XCB_CURRENT_TIME);
- if ((reply = xcb_grab_pointer_reply(conn, cookie, NULL)) == NULL) {
- ELOG("Could not grab pointer\n");
+ if ((reply = xcb_grab_pointer_reply(conn, cookie, &error)) == NULL) {
+ ELOG("Could not grab pointer (error_code = %d)\n", error->error_code);
+ free(error);
return DRAG_ABORT;
}
XCB_GRAB_MODE_ASYNC /* keyboard mode */
);
- if ((keyb_reply = xcb_grab_keyboard_reply(conn, keyb_cookie, NULL)) == NULL) {
- ELOG("Could not grab keyboard\n");
+ if ((keyb_reply = xcb_grab_keyboard_reply(conn, keyb_cookie, &error)) == NULL) {
+ ELOG("Could not grab keyboard (error_code = %d)\n", error->error_code);
+ free(error);
+ xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
return DRAG_ABORT;
}