Some changes from John.

The main attraction seems to be correcting a bug with the action-on-
window-close.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@446 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2004-01-16 00:17:23 +00:00
parent 96d0286492
commit 5e022b0578

View File

@ -116,10 +116,10 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle,
} }
/* /*
* SWP_NOACTIVATE Do not activate the window * SWP_NOACTIVATE Do not activate the window
* SWP_NOOWNERZORDER Do not change position in z-order * SWP_NOOWNERZORDER Do not change position in z-order
* SWP_NOSENDCHANGING Supress WM_WINDOWPOSCHANGING message * SWP_NOSENDCHANGING Supress WM_WINDOWPOSCHANGING message
* SWP_NOZORDER Retains the current Z order (ignore 2nd param) * SWP_NOZORDER Retains the current Z order (ignore 2nd param)
*/ */
SetWindowPos( window->Window.Handle, SetWindowPos( window->Window.Handle,
@ -212,7 +212,7 @@ static void fghcbDisplayWindow( SFG_Window *window,
); );
window->State.NeedToResize = GL_FALSE; window->State.NeedToResize = GL_FALSE;
fgSetWindow( current_window ); fgSetWindow ( current_window );
} }
if( window->State.Redisplay && if( window->State.Redisplay &&
@ -465,10 +465,10 @@ static void fgSleepForEvents( void )
int err; int err;
int socket; int socket;
struct timeval wait; struct timeval wait;
socket = ConnectionNumber( fgDisplay.Display ); socket = ConnectionNumber( fgDisplay.Display );
FD_ZERO( &fdset ); FD_ZERO( &fdset );
FD_SET( socket, &fdset ); FD_SET( socket, &fdset );
wait.tv_sec = msec / 1000; wait.tv_sec = msec / 1000;
wait.tv_usec = (msec % 1000) * 1000; wait.tv_usec = (msec % 1000) * 1000;
err = select( socket+1, &fdset, NULL, NULL, &wait ); err = select( socket+1, &fdset, NULL, NULL, &wait );
@ -477,7 +477,7 @@ static void fgSleepForEvents( void )
fgWarning ( "freeglut select() error: %d\n", errno ); fgWarning ( "freeglut select() error: %d\n", errno );
} }
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS ); MsgWaitForMultipleObjects ( 0, NULL, FALSE, msec, QS_ALLEVENTS );
#endif #endif
} }
@ -596,6 +596,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
case DestroyNotify: case DestroyNotify:
/* /*
* This is sent to confirm the XDestroyWindow call. * This is sent to confirm the XDestroyWindow call.
*
* XXX WHY is this commented out? Should we re-enable it? * XXX WHY is this commented out? Should we re-enable it?
*/ */
/* fgAddToWindowDestroyList ( window ); */ /* fgAddToWindowDestroyList ( window ); */
@ -1051,6 +1052,8 @@ void FGAPIENTRY glutMainLoopEvent( void )
*/ */
void FGAPIENTRY glutMainLoop( void ) void FGAPIENTRY glutMainLoop( void )
{ {
int action;
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32
SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif #endif
@ -1111,9 +1114,12 @@ void FGAPIENTRY glutMainLoop( void )
/* /*
* When this loop terminates, destroy the display, state and structure * When this loop terminates, destroy the display, state and structure
* of a freeglut session, so that another glutInit() call can happen * of a freeglut session, so that another glutInit() call can happen
*
* Save the "ActionOnWindowClose" because "fgDeinitialize" resets it.
*/ */
action = fgState.ActionOnWindowClose;
fgDeinitialize( ); fgDeinitialize( );
if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT ) if( action == GLUT_ACTION_EXIT )
exit( 0 ); exit( 0 );
} }
@ -1224,6 +1230,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
window->State.Width = LOWORD(lParam); window->State.Width = LOWORD(lParam);
window->State.Height = HIWORD(lParam); window->State.Height = HIWORD(lParam);
} }
break; break;
#if 0 #if 0
case WM_SETFOCUS: case WM_SETFOCUS: