X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffg_callbacks.c;h=1d895058444e816abd0ab6e19e3f1ded8d39575c;hb=4a451851ec51ea7c3b79534fa5faebadceedf4df;hp=0b5e18500c00a8093869c53e71085631e1074ab1;hpb=37731b469087d35ce8be6bd2cff95a77c6f4277e;p=freeglut diff --git a/src/fg_callbacks.c b/src/fg_callbacks.c index 0b5e185..1d89505 100644 --- a/src/fg_callbacks.c +++ b/src/fg_callbacks.c @@ -115,7 +115,7 @@ do \ #define IMPLEMENT_CALLBACK_FUNC_2NAME(a,b) \ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \ { \ - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glut"###a##"Func" ); \ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glut"#a"Func" ); \ SET_CALLBACK( b ); \ } #define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a) @@ -165,17 +165,33 @@ void FGAPIENTRY glutDisplayFunc( FGCBDisplay callback ) /* * 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. + * window status is kind of anemic on win32 as there are no window messages + * to notify us that the window is covered by other windows or not. + * Should one want to query this, see + * http://stackoverflow.com/questions/5445889/get-which-process-window-is-actually-visible-in-c-sharp + * for an implementation outline (but it would be polling based, not push based). */ static void fghVisibility( int status ) { - int glut_status = GLUT_VISIBLE; + int vis_status; FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Visibility Callback" ); freeglut_return_if_fail( fgStructure.CurrentWindow ); + /* Translate window status func states to visibility states */ if( ( GLUT_HIDDEN == status ) || ( GLUT_FULLY_COVERED == status ) ) - glut_status = GLUT_NOT_VISIBLE; - INVOKE_WCB( *( fgStructure.CurrentWindow ), Visibility, ( glut_status ) ); + vis_status = GLUT_NOT_VISIBLE; + else /* GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED */ + vis_status = GLUT_VISIBLE; + + INVOKE_WCB( *( fgStructure.CurrentWindow ), Visibility, ( vis_status ) ); } void FGAPIENTRY glutVisibilityFunc( FGCBVisibility callback )