X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_joystick.c;h=af7c54c328ac870298b78c7c1af9f0a9d63a37da;hb=ce2e5aba172eb85cda2b4f047bdcf9f54d019fd7;hp=7548a88efffa90d6fa118c71ca4ffee5b5c155da;hpb=2586d5c2ebd7cc9c788c8f68d2f2e8871f5438f5;p=freeglut diff --git a/src/freeglut_joystick.c b/src/freeglut_joystick.c index 7548a88..af7c54c 100644 --- a/src/freeglut_joystick.c +++ b/src/freeglut_joystick.c @@ -80,7 +80,7 @@ /* XXX The below hack is done until freeglut's autoconf is updated. */ # define HAVE_USB_JS 1 -# if defined(__FreeBSD__) && __FreeBSD_version >= 500000 +# if defined(__FreeBSD__) # include # else /* @@ -656,9 +656,9 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) if (usage > 0 && usage < _JS_MAX_BUTTONS + 1) { if (d) - joy->os->cache_buttons |= (1 << usage - 1); + joy->os->cache_buttons |= (1 << ( usage - 1 )); else - joy->os->cache_buttons &= ~(1 << usage - 1); + joy->os->cache_buttons &= ~(1 << ( usage - 1 )); } } } @@ -1060,10 +1060,15 @@ static void fghJoystickOpen( SFG_Joystick* joy ) # ifdef JS_NEW unsigned char u; # else - int counter; +# if defined( __linux__ ) + int counter; +# endif # endif #endif + /* Silence gcc, the correct #ifdefs would be too fragile... */ + (void)i; + /* * Default values (for no joystick -- each conditional will reset the * error flag) @@ -1581,15 +1586,14 @@ static void fghJoystickInit( int ident ) */ void fgInitialiseJoysticks ( void ) { - /* Initialization courtesy of OpenGLUT -- do we want it? */ - if( !fgState.JoysticksInitialised ) - { - int ident ; - for ( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ ) - fghJoystickInit( ident ); + if( !fgState.JoysticksInitialised ) + { + int ident ; + for ( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ ) + fghJoystickInit( ident ); - fgState.JoysticksInitialised = GL_TRUE; - } + fgState.JoysticksInitialised = GL_TRUE; + } } /* @@ -1680,21 +1684,21 @@ void fgJoystickPollWindow( SFG_Window* window ) */ int fgJoystickDetect( void ) { - int ident; + int ident; - fgInitialiseJoysticks (); + fgInitialiseJoysticks (); - if ( !fgJoystick ) - return 0; + if ( !fgJoystick ) + return 0; - if ( !fgState.JoysticksInitialised ) - return 0; + if ( !fgState.JoysticksInitialised ) + return 0; - for( ident=0; identerror ) - return 1; + for( ident=0; identerror ) + return 1; - return 0; + return 0; } /*