X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_joystick_x11.c;h=04bc3737117efc489bdaf65a116cb8319e4c5976;hb=5a824fe96544516c5f98f18c6ca401de33e5be88;hp=5d686b5de9bc48264b8635976d4894b2ed8736c3;hpb=5b3d339481bac6dbaeb599bffc1325f716585bfe;p=freeglut diff --git a/src/x11/fg_joystick_x11.c b/src/x11/fg_joystick_x11.c index 5d686b5..04bc373 100644 --- a/src/x11/fg_joystick_x11.c +++ b/src/x11/fg_joystick_x11.c @@ -1,5 +1,5 @@ /* - * freeglut_joystick_x11.c + * fg_joystick_x11.c * * Joystick handling code * @@ -39,6 +39,8 @@ # include #endif +#include + /*this should be defined in a header file */ #define MAX_NUM_JOYSTICKS 2 @@ -48,9 +50,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) { int status; - int i; - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int len; if ( joy->pJoystick.os->is_analog ) @@ -117,11 +117,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) } } } -# ifdef HAVE_ERRNO_H if ( len < 0 && errno != EAGAIN ) -# else - if ( len < 0 ) -# endif { perror( joy->pJoystick.os->fname ); joy->error = 1; @@ -140,7 +136,6 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) if ( status != sizeof( struct js_event ) ) { -# ifdef HAVE_ERRNO_H if ( errno == EAGAIN ) { /* Use the old values */ @@ -151,7 +146,6 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) sizeof( float ) * joy->num_axes ); return; } -# endif fgWarning ( "%s", joy->pJoystick.fname ); joy->error = GL_TRUE; @@ -221,7 +215,7 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) void fgPlatformJoystickOpen( SFG_Joystick* joy ) { -#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) +#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) int i = 0; char *cp; #endif @@ -235,7 +229,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy ) # endif #endif -#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) +#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) for( i = 0; i < _JS_MAX_AXES; i++ ) joy->pJoystick.os->cache_axes[ i ] = 0.0f; @@ -243,10 +237,8 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy ) joy->pJoystick.os->fd = open( joy->pJoystick.os->fname, O_RDONLY | O_NONBLOCK); -#ifdef HAVE_ERRNO_H if( joy->pJoystick.os->fd < 0 && errno == EACCES ) fgWarning ( "%s exists but is not readable by you", joy->pJoystick.os->fname ); -#endif joy->error =( joy->pJoystick.os->fd < 0 ); @@ -417,7 +409,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy ) void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident ) { -#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) +#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) fgJoystick[ ident ]->id = ident; fgJoystick[ ident ]->error = GL_FALSE; @@ -444,7 +436,7 @@ void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident ) void fgPlatformJoystickClose ( int ident ) { -#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) +#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) if( fgJoystick[ident]->pJoystick.os ) { if( ! fgJoystick[ ident ]->error )