From 09723d91eb0eb76d1e1808dda17c9a8aaa8afded Mon Sep 17 00:00:00 2001 From: rkrolib Date: Sun, 26 Oct 2003 06:13:50 +0000 Subject: [PATCH] Moved the idle callback out of glutMainLoopEvent() and into glutMainLoop(), per discussion on the list. The code looks okay, to me, though I remain less than wholly convinced that treating idles as special cases is the best way to go. Still, a case can be made for taking "non-event" idle callbacks out of the "event loop". From an organizational perspective, I think that it's an improvement, and it fixes a bug for at least one program. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@244 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 396de79..f6c2239 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -1006,12 +1006,6 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ fghCheckJoystickPolls(); - /* - * No messages in the queue, which means we are idling... - */ - if( fgState.IdleCallback != NULL ) - fgState.IdleCallback(); - /* * Remember about displaying all the windows that have * been marked for a redisplay (possibly in the idle call): @@ -1052,12 +1046,6 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ fghCheckJoystickPolls(); - /* - * No messages in the queue, which means we are idling... - */ - if( fgState.IdleCallback != NULL ) - fgState.IdleCallback(); - /* * Remember about displaying all the windows that have * been marked for a redisplay (possibly in the idle call): @@ -1136,7 +1124,11 @@ void FGAPIENTRY glutMainLoop( void ) if ( fgStructure.Windows.First == NULL ) fgState.ExecState = GLUT_EXEC_STATE_STOP ; else + { + if ( fgState.IdleCallback ) + fgState.IdleCallback (); fgSleepForEvents(); + } } {