X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffg_callbacks.c;h=c83b3f0286cc78333406ed9962a2e5fb41ce6311;hb=56cc35535901ef071bf8acab59ba176355ee3e0e;hp=01b256e9a21f547c5e1a36b67b8cbe41f3946a77;hpb=77ee35c8d522dddac4e2c88e8de166491d4d762c;p=freeglut diff --git a/src/fg_callbacks.c b/src/fg_callbacks.c index 01b256e..c83b3f0 100644 --- a/src/fg_callbacks.c +++ b/src/fg_callbacks.c @@ -165,6 +165,18 @@ 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 ) { @@ -201,13 +213,21 @@ void FGAPIENTRY glutJoystickFunc( FGCBJoystick callback, int pollInterval ) FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickFunc" ); fgInitialiseJoysticks (); - if ( ( ( fgStructure.CurrentWindow->State.JoystickPollRate < 0 ) || - !FETCH_WCB(*fgStructure.CurrentWindow,Joystick) ) && /* Joystick callback was disabled */ - ( callback && ( pollInterval >= 0 ) ) ) /* but is now enabled */ + if ( ( + fgStructure.CurrentWindow->State.JoystickPollRate <= 0 || /* Joystick callback was disabled */ + !FETCH_WCB(*fgStructure.CurrentWindow,Joystick) + ) && + ( + callback && ( pollInterval > 0 ) /* but is now enabled */ + ) ) ++fgState.NumActiveJoysticks; - else if ( ( ( fgStructure.CurrentWindow->State.JoystickPollRate >= 0 ) && - FETCH_WCB(*fgStructure.CurrentWindow,Joystick) ) && /* Joystick callback was enabled */ - ( !callback || ( pollInterval < 0 ) ) ) /* but is now disabled */ + else if ( ( + fgStructure.CurrentWindow->State.JoystickPollRate > 0 && /* Joystick callback was enabled */ + FETCH_WCB(*fgStructure.CurrentWindow,Joystick) + ) && + ( + !callback || ( pollInterval <= 0 ) /* but is now disabled */ + ) ) --fgState.NumActiveJoysticks; SET_CALLBACK( Joystick );