X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=2882edefbbfb0cd2fd3e343dfd7febba2a6ed323;hb=25c02c0a02ba2231f22d69fb2a54b6ede7f17504;hp=1806698c3afa40d9da541fea41d4725fc086b251;hpb=b24329e0e93226fdcef84d3284b1a9eae5686bac;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 1806698..2882ede 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; @@ -603,12 +613,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) * XXX double-buffered does not respect viewport when we * XXX do a buffer-swap). * - * XXX GETWINDOW( xexpose ); - * XXX fgSetWindow( window ); - * XXX glutPostRedisplay( ); */ if( event.xexpose.count == 0 ) - fghRedrawWindowByHandle( event.xexpose.window ); + { + GETWINDOW( xexpose ); + fgSetWindow( window ); + glutPostRedisplay( ); + } break; case MapNotify: