diff options
author | Claudio Ciccani <[email protected]> | 2007-07-01 12:24:44 +0200 |
---|---|---|
committer | Claudio Ciccani <[email protected]> | 2007-07-01 12:24:44 +0200 |
commit | a49570794ab12b42633ecf94faad28abdcbb5bbd (patch) | |
tree | ff68a78ff563ca1758e652a9a89488d7f3c1e97e /src/glut/directfb/events.c | |
parent | 33da6cb133dfcfa434a1360123ecf683af329fa0 (diff) |
Compute the amount of time to sleep on idle event using timers as reference.
Diffstat (limited to 'src/glut/directfb/events.c')
-rw-r--r-- | src/glut/directfb/events.c | 11 |
1 files changed, 9 insertions, 2 deletions
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 ); } } } |