i3bar: fix event handling

i3bar would only handle one event at a time instead of all pending events.
This commit is contained in:
Michael Stapelberg 2011-11-09 23:23:21 +00:00
parent e85a352fcf
commit 7f9b65f6a7
1 changed files with 30 additions and 31 deletions

View File

@ -686,10 +686,7 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
exit(1); exit(1);
} }
while ((event = xcb_poll_for_event(xcb_connection)) == NULL) { while ((event = xcb_poll_for_event(xcb_connection)) != NULL) {
return;
}
switch (event->response_type & ~0x80) { switch (event->response_type & ~0x80) {
case XCB_EXPOSE: case XCB_EXPOSE:
/* Expose-events happen, when the window needs to be redrawn */ /* Expose-events happen, when the window needs to be redrawn */
@ -705,6 +702,7 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
handle_client_message((xcb_client_message_event_t*) event); handle_client_message((xcb_client_message_event_t*) event);
break; break;
case XCB_UNMAP_NOTIFY: case XCB_UNMAP_NOTIFY:
case XCB_DESTROY_NOTIFY:
/* UnmapNotifies are received when a tray window unmaps itself */ /* UnmapNotifies are received when a tray window unmaps itself */
handle_unmap_notify((xcb_unmap_notify_event_t*) event); handle_unmap_notify((xcb_unmap_notify_event_t*) event);
break; break;
@ -717,7 +715,8 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
handle_configure_request((xcb_configure_request_event_t*) event); handle_configure_request((xcb_configure_request_event_t*) event);
break; break;
} }
FREE(event); free(event);
}
} }
/* /*