From: <fa...@us...> - 2012-01-29 03:43:04
|
Revision: 1018 http://freeglut.svn.sourceforge.net/freeglut/?rev=1018&view=rev Author: fayjf Date: 2012-01-29 03:42:57 +0000 (Sun, 29 Jan 2012) Log Message: ----------- Moving the platform-specific code (non-Windows) farther up in the freeglut_joystick.c file Modified Paths: -------------- trunk/freeglut/freeglut/src/Common/freeglut_joystick.c Modified: trunk/freeglut/freeglut/src/Common/freeglut_joystick.c =================================================================== --- trunk/freeglut/freeglut/src/Common/freeglut_joystick.c 2012-01-29 03:38:11 UTC (rev 1017) +++ trunk/freeglut/freeglut/src/Common/freeglut_joystick.c 2012-01-29 03:42:57 UTC (rev 1018) @@ -464,7 +464,52 @@ #define MAX_NUM_JOYSTICKS 2 static SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ]; +/* + * Platform-Specific Code + */ +#if TARGET_HOST_MACINTOSH +void fgPlatformJoystickClose ( int ident ) +{ + ISpSuspend( ); + ISpStop( ); + ISpShutdown( ); +} +#endif + +#if TARGET_HOST_MAC_OSX +void fgPlatformJoystickClose ( int ident ) +{ + ( *( fgJoystick[ ident ]->hidDev ) )-> + close( fgJoystick[ ident ]->hidDev ); +} +#endif + +#if TARGET_HOST_POSIX_X11 +void fgPlatformJoystickClose ( int ident ) +{ +#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) + if( fgJoystick[ident]->os ) + { + if( ! fgJoystick[ ident ]->error ) + close( fgJoystick[ ident ]->os->fd ); +#ifdef HAVE_USB_JS + if( fgJoystick[ ident ]->os->hids ) + free (fgJoystick[ ident ]->os->hids); + if( fgJoystick[ ident ]->os->hid_data_buf ) + free( fgJoystick[ ident ]->os->hid_data_buf ); +#endif + free( fgJoystick[ident]->os ); + } +#endif + + if( ! fgJoystick[ident]->error ) + close( fgJoystick[ ident ]->fd ); +} +#endif + + + /* * Read the raw joystick data */ @@ -1619,51 +1664,7 @@ } } -/* - * - */ -#if TARGET_HOST_MACINTOSH -void fgPlatformJoystickClose ( int ident ) -{ - ISpSuspend( ); - ISpStop( ); - ISpShutdown( ); -} -#endif - -#if TARGET_HOST_MAC_OSX -void fgPlatformJoystickClose ( int ident ) -{ - ( *( fgJoystick[ ident ]->hidDev ) )-> - close( fgJoystick[ ident ]->hidDev ); -} -#endif - -#if TARGET_HOST_POSIX_X11 -void fgPlatformJoystickClose ( int ident ) -{ -#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ ) - if( fgJoystick[ident]->os ) - { - if( ! fgJoystick[ ident ]->error ) - close( fgJoystick[ ident ]->os->fd ); -#ifdef HAVE_USB_JS - if( fgJoystick[ ident ]->os->hids ) - free (fgJoystick[ ident ]->os->hids); - if( fgJoystick[ ident ]->os->hid_data_buf ) - free( fgJoystick[ ident ]->os->hid_data_buf ); -#endif - free( fgJoystick[ident]->os ); - } -#endif - - if( ! fgJoystick[ident]->error ) - close( fgJoystick[ ident ]->fd ); -} -#endif - - void fgJoystickClose( void ) { int ident ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |