diff --git a/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c b/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c index ca52dd5..d80d20e 100644 --- a/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c +++ b/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c @@ -81,7 +81,7 @@ Display(void) glPopMatrix(); - // glutSwapBuffers(); /* Should NOT be here... This is a Single-Buffered Program! */ + glFlush(); glutPostRedisplay(); /* Needed so that this function will be called again */ } @@ -236,10 +236,6 @@ void readConfigFile ( char *fnme ) } } -void Idle(void) { - return; -} - int main(int argc, char *argv[]) { @@ -266,7 +262,6 @@ main(int argc, char *argv[]) glutKeyboardFunc(Key); glutSpecialFunc(Special); glutDisplayFunc(Display); - glutIdleFunc(Idle); glutMainLoop(); diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 1ef3d2b..0c90e21 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -454,6 +454,22 @@ static int fgHaveJoystick( void ) fgEnumWindows( fgCheckJoystickCallback, &enumerator ); return !!enumerator.data; } +static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e) +{ + if( w->State.Redisplay ) + { + e->found = TRUE; + e->data = w; + } +} +static int fgHavePendingRedisplays (void) +{ + SFG_Enumerator enumerator; + enumerator.found = FALSE; + enumerator.data = NULL; + fgEnumWindows( fgHavePendingRedisplaysCallback, &enumerator ); + return !!enumerator.data; +} /* * Indicates whether there are any outstanding timers. */ @@ -490,6 +506,9 @@ static void fgSleepForEvents( void ) struct timeval wait; long msec; + if( fgState.IdleCallback || + fgHavePendingRedisplays() ) + return; socket = ConnectionNumber( fgDisplay.Display ); FD_ZERO( &fdset ); FD_SET( socket, &fdset ); @@ -1227,7 +1246,7 @@ void FGAPIENTRY glutMainLoop( void ) */ if ( fgStructure.Windows.First == NULL ) fgState.ExecState = GLUT_EXEC_STATE_STOP ; - else if( !fgState.IdleCallback ) + else fgSleepForEvents(); } diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index eda79f2..14733e2 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -397,6 +397,10 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i */ fgState.DisplayMode |= GLUT_DOUBLE ; window->Window.VisualInfo = fgChooseVisual(); + /* OK, we got a double-buffered window, but we only wanted + * single-buffered. Clear the double-buffer flag now. + */ + fgState.DisplayMode &= ~GLUT_DOUBLE ; } /*