Moving the platform-specific code (non-Windows) farther up in the freeglut_joystick.c file

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1018 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2012-01-29 03:42:57 +00:00
parent 310d40d945
commit 0f68653742

View File

@ -464,6 +464,51 @@ extern void fgPlatformJoystickClose ( int ident );
#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,50 +1664,6 @@ void fgInitialiseJoysticks ( void )
}
}
/*
*
*/
#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 )
{