From 3c6f9a8fa0aa3c8701a503302ba5d9ef1c592543 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 21 May 2008 15:28:39 +0200 Subject: [PATCH] Revert "[awesome] Remove the two level event loops" This reverts commit 88c9671ab1951f36663d8df7f0510557c9096e72. Conflicts: awesome.c Signed-off-by: Julien Danjou --- awesome.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/awesome.c b/awesome.c index 2f2c3bbc..eb48d561 100644 --- a/awesome.c +++ b/awesome.c @@ -511,13 +511,31 @@ main(int argc, char **argv) if(dbusfd >= 0 && FD_ISSET(dbusfd, &rd)) a_dbus_process_requests(&dbusfd); + /* two level XPending: + * we need to first check we have XEvent to handle + * and if so, we handle them all in a round. + * Then when we have refresh()'ed stuff so maybe new XEvent + * are available and select() won't tell us, so let's check + * with XPending() again. + */ while((ev = xcb_poll_for_event(globalconf.connection))) { - xcb_handle_event(globalconf.evenths, ev); - p_delete(&ev); + do + { + xcb_handle_event(globalconf.evenths, ev); + + /* need to resync */ + xcb_aux_sync(globalconf.connection); + + p_delete(&ev); + } while((ev = xcb_poll_for_event(globalconf.connection))); + + statusbar_refresh(NULL); + layout_refresh(NULL); + + /* need to resync */ + xcb_aux_sync(globalconf.connection); } - statusbar_refresh(NULL); - layout_refresh(NULL); xcb_aux_sync(globalconf.connection); }