library should call window status func at all times, translation to

visibility callback happens if needed. Documented this, and added notes
on visibility/windowstatus func in callbackmaker demo


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1535 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-03-01 03:08:05 +00:00
parent 41dd280289
commit f46574e263
3 changed files with 17 additions and 6 deletions

View File

@ -576,7 +576,6 @@ static void SetWindowCallbacks( int first )
glutPositionFunc( Position ); glutPositionFunc( Position );
glutKeyboardFunc( Key ); glutKeyboardFunc( Key );
glutSpecialFunc( Special ); glutSpecialFunc( Special );
glutVisibilityFunc( Visibility );
glutKeyboardUpFunc( KeyUp ); glutKeyboardUpFunc( KeyUp );
glutSpecialUpFunc( SpecialUp ); glutSpecialUpFunc( SpecialUp );
if (first) if (first)
@ -588,7 +587,6 @@ static void SetWindowCallbacks( int first )
glutEntryFunc ( Entry ) ; glutEntryFunc ( Entry ) ;
glutCloseFunc ( Close ) ; glutCloseFunc ( Close ) ;
glutOverlayDisplayFunc ( OverlayDisplay ) ; glutOverlayDisplayFunc ( OverlayDisplay ) ;
glutWindowStatusFunc ( WindowStatus ) ;
glutSpaceballMotionFunc ( SpaceMotion ) ; glutSpaceballMotionFunc ( SpaceMotion ) ;
glutSpaceballRotateFunc ( SpaceRotation ) ; glutSpaceballRotateFunc ( SpaceRotation ) ;
glutSpaceballButtonFunc ( SpaceButton ) ; glutSpaceballButtonFunc ( SpaceButton ) ;
@ -596,6 +594,11 @@ static void SetWindowCallbacks( int first )
glutDialsFunc ( Dials ) ; glutDialsFunc ( Dials ) ;
glutTabletMotionFunc ( TabletMotion ) ; glutTabletMotionFunc ( TabletMotion ) ;
glutTabletButtonFunc ( TabletButton ) ; glutTabletButtonFunc ( TabletButton ) ;
/* glutVisibilityFunc is deprecated in favor of glutWindowStatusFunc, which provides more detail.
* Setting one of these overwrites the other (see docs).
*/
glutVisibilityFunc ( Visibility ); /* This will thus never be called, as glutWindowStatusFunc is set afterwards */
glutWindowStatusFunc ( WindowStatus ) ;
} }
int int

View File

@ -165,6 +165,13 @@ void FGAPIENTRY glutDisplayFunc( FGCBDisplay callback )
/* /*
* Sets the Visibility callback for the current window. * Sets the Visibility callback for the current window.
* NB: the Visibility func is deprecated in favor of the WindowStatus func,
* which provides more detail. The visibility func callback is implemented
* as a translation step from the windowStatus func. When the user sets the
* windowStatus func, any visibility func is overwritten.
* DEVELOPER NOTE: in the library, only invoke the window status func, this
* gets automatically translated to the visibility func if thats what the
* user has set.
*/ */
static void fghVisibility( int status ) static void fghVisibility( int status )
{ {

View File

@ -143,11 +143,11 @@ void fgPlatformMainLoopPreliminaryWork ( void )
*/ */
while( window ) while( window )
{ {
if ( FETCH_WCB( *window, Visibility ) ) if ( FETCH_WCB( *window, WindowStatus ) )
{ {
SFG_Window *current_window = fgStructure.CurrentWindow ; SFG_Window *current_window = fgStructure.CurrentWindow ;
INVOKE_WCB( *window, Visibility, ( window->State.Visible ) ); INVOKE_WCB( *window, WindowStatus, ( window->State.Visible?GLUT_FULLY_RETAINED:GLUT_HIDDEN ) );
fgSetWindow( current_window ); fgSetWindow( current_window );
} }
@ -872,8 +872,9 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
if (!lParam || !fgWindowByHandle((HWND)lParam)) if (!lParam || !fgWindowByHandle((HWND)lParam))
/* Capture released or capture taken by non-FreeGLUT window */ /* Capture released or capture taken by non-FreeGLUT window */
setCaptureActive = 0; setCaptureActive = 0;
/* User has finished resizing the window, force a redraw */ /* Docs advise a redraw */
INVOKE_WCB( *window, Display, ( ) ); InvalidateRect( hWnd, NULL, GL_FALSE );
UpdateWindow(hWnd);
lRet = 0; /* Per docs, should return zero */ lRet = 0; /* Per docs, should return zero */
break; break;