X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffg_callbacks.c;h=7c82c8186d78aeadecff7fa2ee84da6dfbe56661;hb=0419dcb7f0e2233947f76f54cbb635ddf9e03bbb;hp=1d895058444e816abd0ab6e19e3f1ded8d39575c;hpb=0b246b477db787417d63339648d13e3b7afc35af;p=freeglut diff --git a/src/fg_callbacks.c b/src/fg_callbacks.c index 1d89505..7c82c81 100644 --- a/src/fg_callbacks.c +++ b/src/fg_callbacks.c @@ -121,7 +121,6 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \ #define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a) /* Implement all these callback setter functions... */ -IMPLEMENT_CALLBACK_FUNC(Reshape); IMPLEMENT_CALLBACK_FUNC(Position); IMPLEMENT_CALLBACK_FUNC(Keyboard); IMPLEMENT_CALLBACK_FUNC(KeyboardUp); @@ -146,8 +145,7 @@ IMPLEMENT_CALLBACK_FUNC(MultiButton); IMPLEMENT_CALLBACK_FUNC(MultiMotion); IMPLEMENT_CALLBACK_FUNC(MultiPassive); IMPLEMENT_CALLBACK_FUNC(InitContext); -IMPLEMENT_CALLBACK_FUNC(Pause); -IMPLEMENT_CALLBACK_FUNC(Resume); +IMPLEMENT_CALLBACK_FUNC(AppStatus); @@ -163,6 +161,21 @@ void FGAPIENTRY glutDisplayFunc( FGCBDisplay callback ) SET_CALLBACK( Display ); } +void fghDefaultReshape(int width, int height) +{ + glViewport( 0, 0, width, height ); +} + +void FGAPIENTRY glutReshapeFunc( FGCBReshape callback ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeFunc" ); + + if( !callback ) + callback = fghDefaultReshape; + + SET_CALLBACK( Reshape ); +} + /* * Sets the Visibility callback for the current window. * NB: the Visibility func is deprecated in favor of the WindowStatus func, @@ -213,13 +226,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 );