X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffreeglut_main.c;h=4a4d9c6dc0878fd3822b685e9bd351b53f6fa91b;hb=935d65c3d5a7c332d7dcba970b9f432a622f316c;hp=5fbce0c7ee3053cceffc5527fd695bff8191fb70;hpb=5800cecd9ce89911e948c2e0abc982bfb5e8b675;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 5fbce0c..4a4d9c6 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -1088,16 +1088,27 @@ void FGAPIENTRY glutMainLoop( void ) fgState.ExecState = GLUT_EXEC_STATE_RUNNING ; while( fgState.ExecState == GLUT_EXEC_STATE_RUNNING ) { - glutMainLoopEvent( ); + SFG_Window *window; - if( fgStructure.Windows.First == NULL ) + glutMainLoopEvent( ); + /* + * Step through the list of windows, seeing if there are any + * that are not menus + */ + for( window = ( SFG_Window * )fgStructure.Windows.First; + window; + window = ( SFG_Window * )window->Node.Next ) + if ( ! ( window->IsMenu ) ) + break; + + if( ! window ) fgState.ExecState = GLUT_EXEC_STATE_STOP; else { if( fgState.IdleCallback ) fgState.IdleCallback( ); - fgSleepForEvents(); + fgSleepForEvents( ); } } @@ -1106,6 +1117,8 @@ void FGAPIENTRY glutMainLoop( void ) * of a freeglut session, so that another glutInit() call can happen */ fgDeinitialize( ); + if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT ) + exit( 0 ); } /*