Merge handle_xcb_event() into xcb_chk_cb()

This commit is contained in:
Axel Wagner 2010-08-07 02:19:25 +02:00
parent cee972280d
commit 188d4c18cc
1 changed files with 13 additions and 21 deletions

View File

@ -123,25 +123,6 @@ void handle_button(xcb_button_press_event_t *event) {
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer); i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer);
} }
/*
* An X-Event occured, we determine, what kind and call the appropriate handler
*
* FIXME: Merge this in ev_chk_cb(), the additional call is superflous
*
*/
void handle_xcb_event(xcb_generic_event_t *event) {
switch (event->response_type & ~0x80) {
case XCB_EXPOSE:
/* Expose-events happen, when the window needs to be redrawn */
draw_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;
}
}
/* /*
* This function is called immediately bevor the main loop locks. We flush xcb * This function is called immediately bevor the main loop locks. We flush xcb
* then (and only then) * then (and only then)
@ -161,8 +142,19 @@ void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revenst) {
*/ */
void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) { void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
xcb_generic_event_t *event; xcb_generic_event_t *event;
if ((event = xcb_poll_for_event(xcb_connection)) != NULL) { if ((event = xcb_poll_for_event(xcb_connection)) == NULL) {
handle_xcb_event(event); return;
}
switch (event->response_type & ~0x80) {
case XCB_EXPOSE:
/* Expose-events happen, when the window needs to be redrawn */
draw_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;
} }
FREE(event); FREE(event);
} }