From: Michael Stapelberg Date: Sun, 31 Jul 2011 19:21:45 +0000 (+0200) Subject: Bugfix: Handle (and free) the last_motion_notify X-Git-Tag: 4.0~14^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bc98185f85985198650d3cb1c3130299a8f3227d;p=i3%2Fi3 Bugfix: Handle (and free) the last_motion_notify --- diff --git a/src/floating.c b/src/floating.c index 97b5e6a0..f13476db 100644 --- a/src/floating.c +++ b/src/floating.c @@ -430,8 +430,9 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t 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 */ @@ -444,7 +445,8 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t switch (type) { case XCB_BUTTON_RELEASE: - goto done; + loop_done = true; + break; case XCB_MOTION_NOTIFY: /* motion_notify events are saved for later */ @@ -457,7 +459,8 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t 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"); @@ -478,7 +481,7 @@ void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t callback(con, &old_rect, new_x, new_y, extra); FREE(last_motion_notify); } -done: + xcb_ungrab_pointer(conn, XCB_CURRENT_TIME); xcb_flush(conn); }