xcb_flush(conn);
xcb_generic_event_t *inside_event, *last_motion_notify = NULL;
+ bool loop_done = false;
/* I’ve always wanted to have my own eventhandler… */
- while ((inside_event = xcb_wait_for_event(conn))) {
+ while (!loop_done && (inside_event = xcb_wait_for_event(conn))) {
/* We now handle all events we can get using xcb_poll_for_event */
do {
/* skip x11 errors */
switch (type) {
case XCB_BUTTON_RELEASE:
- goto done;
+ loop_done = true;
+ break;
case XCB_MOTION_NOTIFY:
/* motion_notify events are saved for later */
case XCB_KEY_RELEASE:
DLOG("Unmap-notify, aborting\n");
handle_event(type, inside_event);
- goto done;
+ loop_done = true;
+ break;
default:
DLOG("Passing to original handler\n");
callback(con, &old_rect, new_x, new_y, extra);
FREE(last_motion_notify);
}
-done:
+
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
xcb_flush(conn);
}