From 04c3b30285b1c5dff92f3c5fa432d41985da3b43 Mon Sep 17 00:00:00 2001 From: Richard Rauch Date: Sun, 1 Feb 2004 09:18:59 +0000 Subject: [PATCH] Close a bug whereby events can be delayed arbitrarily long if they get caught between the socket and the client-side queue on X, sometime after glutMainLoopEvent()'s loop quits and before the sleep code is invoked. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@449 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 1806698..68c530c 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -452,6 +452,16 @@ static void fgSleepForEvents( void ) msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */ #if TARGET_HOST_UNIX_X11 + /* + * Possibly due to aggressive use of XFlush() and friends, + * it is possible to have our socket drained but still have + * unprocessed events. (Or, this may just be normal with + * X, anyway?) We do non-trivial processing of X events + * after tham in event-reading loop, in any case, so we + * need to allow that we may have an empty socket but non- + * empty event queue. + */ + if( ! XPending( fgDisplay.Display ) ) { fd_set fdset; int err; -- 1.7.10.4