Removing some duplicate code from "freeglut_init.c" and its Windows version
authorJohn F. Fay <johnffay@nettally.com>
Fri, 20 Jan 2012 04:20:28 +0000 (04:20 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Fri, 20 Jan 2012 04:20:28 +0000 (04:20 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@988 7f0cb862-5218-0410-a997-914c9d46530a

src/Common/freeglut_init.c
src/mswin/freeglut_init_mswin.c

index 1640482..443de0b 100644 (file)
@@ -322,8 +322,7 @@ static void fghInitialize( const char* displayName )
 \r
 #endif\r
 \r
 \r
 #endif\r
 \r
-#if TARGET_HOST_POSIX_X11\r
-static void fghDeinitialiseInputDevices ( void )\r
+void fghCloseInputDevices ( void )\r
 {\r
     if ( fgState.JoysticksInitialised )\r
         fgJoystickClose( );\r
 {\r
     if ( fgState.JoysticksInitialised )\r
         fgJoystickClose( );\r
@@ -336,6 +335,16 @@ static void fghDeinitialiseInputDevices ( void )
 }\r
 \r
 \r
 }\r
 \r
 \r
+#if TARGET_HOST_POSIX_X11\r
+static void fghDeinitialiseInputDevices ( void )\r
+{\r
+       fghCloseInputDevices ();\r
+\r
+    fgState.JoysticksInitialised = GL_FALSE;\r
+    fgState.InputDevsInitialised = GL_FALSE;\r
+}\r
+\r
+\r
 static void fghCloseDisplay ( void )\r
 {\r
     /*\r
 static void fghCloseDisplay ( void )\r
 {\r
     /*\r
index c134a63..772116c 100644 (file)
@@ -129,14 +129,12 @@ void fghInitialize( const char* displayName )
 \r
 \r
 /* Platform-Specific Deinitialization Functions: */\r
 \r
 \r
 /* Platform-Specific Deinitialization Functions: */\r
+extern void fghCloseInputDevices ( void );\r
+\r
 void fghDeinitialiseInputDevices ( void )\r
 {\r
 #if !defined(_WIN32_WCE)\r
 void fghDeinitialiseInputDevices ( void )\r
 {\r
 #if !defined(_WIN32_WCE)\r
-    if ( fgState.JoysticksInitialised )\r
-        fgJoystickClose( );\r
-\r
-    if ( fgState.InputDevsInitialised )\r
-        fgInputDeviceClose( );\r
+       fghCloseInputDevices ();\r
 #endif /* !defined(_WIN32_WCE) */\r
     fgState.JoysticksInitialised = GL_FALSE;\r
     fgState.InputDevsInitialised = GL_FALSE;\r
 #endif /* !defined(_WIN32_WCE) */\r
     fgState.JoysticksInitialised = GL_FALSE;\r
     fgState.InputDevsInitialised = GL_FALSE;\r