Moving the platform-specific code (non-Windows) farther up in the freeglut_joystick...
authorJohn F. Fay <johnffay@nettally.com>
Sun, 29 Jan 2012 03:42:57 +0000 (03:42 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Sun, 29 Jan 2012 03:42:57 +0000 (03:42 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1018 7f0cb862-5218-0410-a997-914c9d46530a

src/Common/freeglut_joystick.c

index 416091f..bf5bf95 100644 (file)
@@ -464,6 +464,51 @@ extern void fgPlatformJoystickClose ( int ident );
 #define MAX_NUM_JOYSTICKS  2\r
 static SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];\r
 \r
+/*\r
+ *  Platform-Specific Code\r
+ */\r
+\r
+#if TARGET_HOST_MACINTOSH\r
+void fgPlatformJoystickClose ( int ident )\r
+{\r
+    ISpSuspend( );\r
+    ISpStop( );\r
+    ISpShutdown( );\r
+}\r
+#endif\r
+\r
+#if TARGET_HOST_MAC_OSX\r
+void fgPlatformJoystickClose ( int ident )\r
+{\r
+    ( *( fgJoystick[ ident ]->hidDev ) )->\r
+        close( fgJoystick[ ident ]->hidDev );\r
+}\r
+#endif\r
+\r
+#if TARGET_HOST_POSIX_X11\r
+void fgPlatformJoystickClose ( int ident )\r
+{\r
+#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )\r
+    if( fgJoystick[ident]->os )\r
+    {\r
+        if( ! fgJoystick[ ident ]->error )\r
+            close( fgJoystick[ ident ]->os->fd );\r
+#ifdef HAVE_USB_JS\r
+        if( fgJoystick[ ident ]->os->hids )\r
+            free (fgJoystick[ ident ]->os->hids);\r
+        if( fgJoystick[ ident ]->os->hid_data_buf )\r
+            free( fgJoystick[ ident ]->os->hid_data_buf );\r
+#endif\r
+        free( fgJoystick[ident]->os );\r
+       }\r
+#endif\r
+\r
+    if( ! fgJoystick[ident]->error )\r
+         close( fgJoystick[ ident ]->fd );\r
+}\r
+#endif\r
+\r
+\r
 \r
 /*\r
  * Read the raw joystick data\r
@@ -1619,50 +1664,6 @@ void fgInitialiseJoysticks ( void )
     }\r
 }\r
 \r
-/*\r
- *\r
- */\r
-\r
-#if TARGET_HOST_MACINTOSH\r
-void fgPlatformJoystickClose ( int ident )\r
-{\r
-    ISpSuspend( );\r
-    ISpStop( );\r
-    ISpShutdown( );\r
-}\r
-#endif\r
-\r
-#if TARGET_HOST_MAC_OSX\r
-void fgPlatformJoystickClose ( int ident )\r
-{\r
-    ( *( fgJoystick[ ident ]->hidDev ) )->\r
-        close( fgJoystick[ ident ]->hidDev );\r
-}\r
-#endif\r
-\r
-#if TARGET_HOST_POSIX_X11\r
-void fgPlatformJoystickClose ( int ident )\r
-{\r
-#if defined( __FreeBSD__ ) || defined(__FreeBSD_kernel__) || defined( __NetBSD__ )\r
-    if( fgJoystick[ident]->os )\r
-    {\r
-        if( ! fgJoystick[ ident ]->error )\r
-            close( fgJoystick[ ident ]->os->fd );\r
-#ifdef HAVE_USB_JS\r
-        if( fgJoystick[ ident ]->os->hids )\r
-            free (fgJoystick[ ident ]->os->hids);\r
-        if( fgJoystick[ ident ]->os->hid_data_buf )\r
-            free( fgJoystick[ ident ]->os->hid_data_buf );\r
-#endif\r
-        free( fgJoystick[ident]->os );\r
-       }\r
-#endif\r
-\r
-    if( ! fgJoystick[ident]->error )\r
-         close( fgJoystick[ ident ]->fd );\r
-}\r
-#endif\r
-\r
 \r
 void fgJoystickClose( void )\r
 {\r