X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=582e89df1f6a9d1c3f03c1c1dbb8299cee47a806;hb=1334fab6bdba435989bf7a9112759dea1d4b3696;hp=396de79611073b1741dfa140e9e983ce8579cb72;hpb=6c4019c151f3dd77cf7d32efa4c0523bf633c4e1;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 396de79..582e89d 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -995,30 +995,6 @@ void FGAPIENTRY glutMainLoopEvent( void ) } } - { - /* - * Have all the timers checked. - */ - fghCheckTimers(); - - /* - * Poll the joystick and notify all windows that want to be notified... - */ - 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): - */ - fghDisplayAll(); - } - #elif TARGET_HOST_WIN32 MSG stMsg; @@ -1041,34 +1017,11 @@ void FGAPIENTRY glutMainLoopEvent( void ) DispatchMessage( &stMsg ); } - { - /* - * Have all the timers checked. - */ - fghCheckTimers(); - - /* - * Poll the joystick and notify all windows that want to be notified... - */ - 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): - */ - fghDisplayAll(); - } #endif - /* - * If an event caused a window to be closed, do the actual closing here - */ + fghCheckTimers (); + fghCheckJoystickPolls (); + fghDisplayAll (); fgCloseWindows () ; } @@ -1081,36 +1034,25 @@ void FGAPIENTRY glutMainLoop( void ) SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; #endif - /* - * Make sure the display has been created etc. - */ freeglut_assert_ready; #if TARGET_HOST_WIN32 /* - * Processing before the main loop: If there is a window which is open and which - * has a visibility callback, call it. I know this is an ugly hack, but I'm not sure - * what else to do about it. Ideally we should leave something uninitialized in the - * create window code and initialize it in the main loop, and have that initialization - * create a "WM_ACTIVATE" message. Then we would put the visibility callback code in - * the "case WM_ACTIVATE" block below. - John Fay -- 10/24/02 + * Processing before the main loop: If there is a window which is open and + * which has a visibility callback, call it. I know this is an ugly hack, + * but I'm not sure what else to do about it. Ideally we should leave + * something uninitialized in the create window code and initialize it in + * the main loop, and have that initialization create a "WM_ACTIVATE" + * message. Then we would put the visibility callback code in the + * "case WM_ACTIVATE" block below. - John Fay -- 10/24/02 */ while ( window != NULL ) { if ( window->Callbacks.Visibility != NULL ) { SFG_Window *current_window = fgStructure.Window ; - - /* - * Set the current window - */ fgSetWindow( window ); - window->Callbacks.Visibility ( window->State.Visible ) ; - - /* - * Restore the current window - */ fgSetWindow( current_window ); } @@ -1118,25 +1060,19 @@ void FGAPIENTRY glutMainLoop( void ) } #endif - /* - * Set freeglut to be running - */ fgState.ExecState = GLUT_EXEC_STATE_RUNNING ; - /* - * Enter the main loop itself. Inside the loop, process events and check for loop exit. - */ while ( fgState.ExecState == GLUT_EXEC_STATE_RUNNING ) { glutMainLoopEvent () ; - - /* - * If there are no more windows open, stop execution - */ if ( fgStructure.Windows.First == NULL ) fgState.ExecState = GLUT_EXEC_STATE_STOP ; else + { + if ( fgState.IdleCallback ) + fgState.IdleCallback (); fgSleepForEvents(); + } } { @@ -1148,9 +1084,6 @@ void FGAPIENTRY glutMainLoop( void ) */ fgDeinitialize(); - /* - * Check whether we return to the calling program or simply exit - */ if ( execState == GLUT_ACTION_EXIT ) exit ( 0 ) ; }