From: Michael Stapelberg Date: Wed, 9 Nov 2011 23:23:21 +0000 (+0000) Subject: i3bar: fix event handling X-Git-Tag: 4.1~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7f9b65f6a752e454c492447be4e21e2ee8faf8fd;p=i3%2Fi3 i3bar: fix event handling i3bar would only handle one event at a time instead of all pending events. --- diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index b4af10ba..29ffe1c4 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -686,38 +686,37 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) { exit(1); } - while ((event = xcb_poll_for_event(xcb_connection)) == NULL) { - return; - } - - switch (event->response_type & ~0x80) { - case XCB_EXPOSE: - /* Expose-events happen, when the window needs to be redrawn */ - redraw_bars(); - break; - case XCB_BUTTON_PRESS: - /* Button-press-events are mouse-buttons clicked on one of our bars */ - handle_button((xcb_button_press_event_t*) event); - break; - case XCB_CLIENT_MESSAGE: - /* Client messages are used for client-to-client communication, for - * example system tray widgets talk to us directly via client messages. */ - handle_client_message((xcb_client_message_event_t*) event); - break; - case XCB_UNMAP_NOTIFY: - /* UnmapNotifies are received when a tray window unmaps itself */ - handle_unmap_notify((xcb_unmap_notify_event_t*) event); - break; - case XCB_PROPERTY_NOTIFY: - /* PropertyNotify */ - handle_property_notify((xcb_property_notify_event_t*) event); - break; - case XCB_CONFIGURE_REQUEST: - /* ConfigureRequest, sent by a tray child */ - handle_configure_request((xcb_configure_request_event_t*) event); - break; + while ((event = xcb_poll_for_event(xcb_connection)) != NULL) { + switch (event->response_type & ~0x80) { + case XCB_EXPOSE: + /* Expose-events happen, when the window needs to be redrawn */ + redraw_bars(); + break; + case XCB_BUTTON_PRESS: + /* Button-press-events are mouse-buttons clicked on one of our bars */ + handle_button((xcb_button_press_event_t*) event); + break; + case XCB_CLIENT_MESSAGE: + /* Client messages are used for client-to-client communication, for + * example system tray widgets talk to us directly via client messages. */ + handle_client_message((xcb_client_message_event_t*) event); + break; + case XCB_UNMAP_NOTIFY: + case XCB_DESTROY_NOTIFY: + /* UnmapNotifies are received when a tray window unmaps itself */ + handle_unmap_notify((xcb_unmap_notify_event_t*) event); + break; + case XCB_PROPERTY_NOTIFY: + /* PropertyNotify */ + handle_property_notify((xcb_property_notify_event_t*) event); + break; + case XCB_CONFIGURE_REQUEST: + /* ConfigureRequest, sent by a tray child */ + handle_configure_request((xcb_configure_request_event_t*) event); + break; + } + free(event); } - FREE(event); } /*