From: Dana Jansens Date: Wed, 5 Mar 2008 01:09:35 +0000 (-0500) Subject: fix the select() call to work after it has timed out, and always flush at the end... X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=a5ce9b7a737e15381cceca458199b0e406c1cb96;p=dana%2Fdcompmgr.git fix the select() call to work after it has timed out, and always flush at the end of everything, before going back to the select() --- diff --git a/dcompmgr.c b/dcompmgr.c index f441f8a..d39b101 100644 --- a/dcompmgr.c +++ b/dcompmgr.c @@ -136,12 +136,6 @@ static void run(d_display_t *dpy) { gboolean quit; - fd_set fds; - int max = -1; - - FD_ZERO(&fds); - FD_SET(dpy->fd, &fds); - max = MAX(max, dpy->fd); paint(dpy); @@ -150,6 +144,7 @@ run(d_display_t *dpy) struct timeval next, now, *wait; int r, npaint; d_list_it_t *it; + fd_set fds; npaint = 0; for (it = list_top(dpy->screens); it; it = it->next) { @@ -181,7 +176,10 @@ run(d_display_t *dpy) wait = &next; } - r = select(max+1, &fds, NULL, NULL, wait); + FD_ZERO(&fds); + FD_SET(dpy->fd, &fds); + + r = select(dpy->fd+1, &fds, NULL, NULL, wait); if (r < 0) printf("select error\n"); else if (r == 0) { @@ -197,6 +195,8 @@ run(d_display_t *dpy) if (xcb_connection_has_error(dpy->conn)) quit = TRUE; + else + xcb_flush(dpy->conn); } }