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:
parent
96d0286492
commit
5e022b0578
@ -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,
|
||||||
@ -202,17 +202,17 @@ static void fghcbDisplayWindow( SFG_Window *window,
|
|||||||
if( window->State.NeedToResize )
|
if( window->State.NeedToResize )
|
||||||
{
|
{
|
||||||
SFG_Window *current_window = fgStructure.Window;
|
SFG_Window *current_window = fgStructure.Window;
|
||||||
|
|
||||||
fgSetWindow( window );
|
fgSetWindow( window );
|
||||||
|
|
||||||
fghReshapeWindowByHandle(
|
fghReshapeWindowByHandle(
|
||||||
window->Window.Handle,
|
window->Window.Handle,
|
||||||
window->State.Width,
|
window->State.Width,
|
||||||
window->State.Height
|
window->State.Height
|
||||||
);
|
);
|
||||||
|
|
||||||
window->State.NeedToResize = GL_FALSE;
|
window->State.NeedToResize = GL_FALSE;
|
||||||
fgSetWindow( current_window );
|
fgSetWindow ( current_window );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( window->State.Redisplay &&
|
if( window->State.Redisplay &&
|
||||||
@ -450,11 +450,11 @@ static long fgNextTimer( void )
|
|||||||
*/
|
*/
|
||||||
static void fgSleepForEvents( void )
|
static void fgSleepForEvents( void )
|
||||||
{
|
{
|
||||||
long msec;
|
long msec;
|
||||||
|
|
||||||
if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
|
if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
msec = fgNextTimer( );
|
msec = fgNextTimer( );
|
||||||
if( fgHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
|
if( fgHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
|
||||||
msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
|
msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
|
||||||
@ -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:
|
||||||
|
Reference in New Issue
Block a user