From 18d6896264e11c98c3dcd625c20138f8f59e3055 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Fri, 20 Jan 2012 04:20:28 +0000 Subject: [PATCH 1/1] Removing some duplicate code from "freeglut_init.c" and its Windows version 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 | 13 +++++++++++-- src/mswin/freeglut_init_mswin.c | 8 +++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Common/freeglut_init.c b/src/Common/freeglut_init.c index 1640482..443de0b 100644 --- a/src/Common/freeglut_init.c +++ b/src/Common/freeglut_init.c @@ -322,8 +322,7 @@ static void fghInitialize( const char* displayName ) #endif -#if TARGET_HOST_POSIX_X11 -static void fghDeinitialiseInputDevices ( void ) +void fghCloseInputDevices ( void ) { if ( fgState.JoysticksInitialised ) fgJoystickClose( ); @@ -336,6 +335,16 @@ static void fghDeinitialiseInputDevices ( void ) } +#if TARGET_HOST_POSIX_X11 +static void fghDeinitialiseInputDevices ( void ) +{ + fghCloseInputDevices (); + + fgState.JoysticksInitialised = GL_FALSE; + fgState.InputDevsInitialised = GL_FALSE; +} + + static void fghCloseDisplay ( void ) { /* diff --git a/src/mswin/freeglut_init_mswin.c b/src/mswin/freeglut_init_mswin.c index c134a63..772116c 100644 --- a/src/mswin/freeglut_init_mswin.c +++ b/src/mswin/freeglut_init_mswin.c @@ -129,14 +129,12 @@ void fghInitialize( const char* displayName ) /* Platform-Specific Deinitialization Functions: */ +extern void fghCloseInputDevices ( void ); + void fghDeinitialiseInputDevices ( void ) { #if !defined(_WIN32_WCE) - if ( fgState.JoysticksInitialised ) - fgJoystickClose( ); - - if ( fgState.InputDevsInitialised ) - fgInputDeviceClose( ); + fghCloseInputDevices (); #endif /* !defined(_WIN32_WCE) */ fgState.JoysticksInitialised = GL_FALSE; fgState.InputDevsInitialised = GL_FALSE; -- 1.7.10.4