Cleaned up glutMainLoop() a bit:

* Deleted numerous say-nothing-new comments.
 * Reformatted a say-something-useful comment to fit on an 80-column
   display.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@246 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-10-27 05:12:09 +00:00
parent 4eeaaaa08c
commit b906986ac4

View File

@ -1034,36 +1034,25 @@ void FGAPIENTRY glutMainLoop( void )
SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif #endif
/*
* Make sure the display has been created etc.
*/
freeglut_assert_ready; freeglut_assert_ready;
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32
/* /*
* Processing before the main loop: If there is a window which is open and which * Processing before the main loop: If there is a window which is open and
* has a visibility callback, call it. I know this is an ugly hack, but I'm not sure * which has a visibility callback, call it. I know this is an ugly hack,
* what else to do about it. Ideally we should leave something uninitialized in the * but I'm not sure what else to do about it. Ideally we should leave
* create window code and initialize it in the main loop, and have that initialization * something uninitialized in the create window code and initialize it in
* create a "WM_ACTIVATE" message. Then we would put the visibility callback code in * the main loop, and have that initialization create a "WM_ACTIVATE"
* the "case WM_ACTIVATE" block below. - John Fay -- 10/24/02 * message. Then we would put the visibility callback code in the
* "case WM_ACTIVATE" block below. - John Fay -- 10/24/02
*/ */
while ( window != NULL ) while ( window != NULL )
{ {
if ( window->Callbacks.Visibility != NULL ) if ( window->Callbacks.Visibility != NULL )
{ {
SFG_Window *current_window = fgStructure.Window ; SFG_Window *current_window = fgStructure.Window ;
/*
* Set the current window
*/
fgSetWindow( window ); fgSetWindow( window );
window->Callbacks.Visibility ( window->State.Visible ) ; window->Callbacks.Visibility ( window->State.Visible ) ;
/*
* Restore the current window
*/
fgSetWindow( current_window ); fgSetWindow( current_window );
} }
@ -1071,21 +1060,11 @@ void FGAPIENTRY glutMainLoop( void )
} }
#endif #endif
/*
* Set freeglut to be running
*/
fgState.ExecState = GLUT_EXEC_STATE_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 ) while ( fgState.ExecState == GLUT_EXEC_STATE_RUNNING )
{ {
glutMainLoopEvent () ; glutMainLoopEvent () ;
/*
* If there are no more windows open, stop execution
*/
if ( fgStructure.Windows.First == NULL ) if ( fgStructure.Windows.First == NULL )
fgState.ExecState = GLUT_EXEC_STATE_STOP ; fgState.ExecState = GLUT_EXEC_STATE_STOP ;
else else
@ -1105,9 +1084,6 @@ void FGAPIENTRY glutMainLoop( void )
*/ */
fgDeinitialize(); fgDeinitialize();
/*
* Check whether we return to the calling program or simply exit
*/
if ( execState == GLUT_ACTION_EXIT ) if ( execState == GLUT_ACTION_EXIT )
exit ( 0 ) ; exit ( 0 ) ;
} }