From a49570794ab12b42633ecf94faad28abdcbb5bbd Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sun, 1 Jul 2007 12:24:44 +0200 Subject: Compute the amount of time to sleep on idle event using timers as reference. --- src/glut/directfb/events.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/glut/directfb/events.c') diff --git a/src/glut/directfb/events.c b/src/glut/directfb/events.c index 4c474710abe..6ebdd166ac8 100644 --- a/src/glut/directfb/events.c +++ b/src/glut/directfb/events.c @@ -435,13 +435,14 @@ glutMainLoop( void ) { __glutAssert( events != NULL ); + __glutHandleWindows(); + while (GL_TRUE) { DFBEvent evt, prev; g_idle = GL_TRUE; __glutHandleTimers(); - __glutHandleWindows(); prev.clazz = DFEC_NONE; @@ -471,13 +472,19 @@ glutMainLoop( void ) __glutHandleTimers(); } + __glutHandleWindows(); + if (g_idle) { if (idle_func) { idle_func(); } else { + int msec; __glutSetWindow( NULL ); - usleep( 500 ); + if (__glutGetTimeout( &msec )) + events->WaitForEventWithTimeout( events, msec/1000, msec%1000 ); + else + events->WaitForEvent( events ); } } } -- cgit v1.2.3