From dda6bf6304f0a57b6f641d4167eef9b50151dcf9 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 17 Jul 2012 14:01:28 +0200 Subject: [PATCH] Reduce the timeout for improved responsiveness. --- bar.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bar.c b/bar.c index 4b82180..306a70b 100644 --- a/bar.c +++ b/bar.c @@ -157,7 +157,6 @@ init (void) xcb_close_font (c, xf); /* Make the bar visible */ xcb_map_window (c, win); - xcb_flush (c); } int @@ -192,19 +191,21 @@ main (int argc, char **argv) fillrect (0, 0, 0, bw, BAR_HEIGHT); for (;;) { - if (!hup && poll (&pollin, 1, 1001) > 0) { + if (!hup && poll (&pollin, 1, 500) > 0) { if (pollin.revents & POLLHUP) hup = 1; fgets (input, sizeof(input), stdin); parse (input); xcb_copy_area (c, canvas, win, gc, 0, 0, 0, 0, bw, BAR_HEIGHT); } - if ((ev = xcb_poll_for_event (c))) { + + while ((ev = xcb_poll_for_event (c))) { expose_ev = (xcb_expose_event_t *)ev; - switch (ev->response_type) { + switch (ev->response_type & 0x7F) { case XCB_EXPOSE: xcb_copy_area (c, canvas, win, gc, expose_ev->x, expose_ev->y, expose_ev->x, expose_ev->y, expose_ev->width, expose_ev->height); break; } + free (ev); }