X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=0853d35ceca683c7bcdf40bc9f808c3bde2a6696;hb=006650e1dd72e73249d41e2bcea8b1668262a999;hp=33a80f82d9efe15be4a85eaa27d83e85f7972365;hpb=4fa63bbb5637f30db8eec9de49c0b2c4830cb866;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 33a80f8..0853d35 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -85,7 +85,8 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ 72, /* GameModeRefresh */ GLUT_ACTION_EXIT, /* ActionOnWindowClose */ GLUT_EXEC_STATE_INIT, /* ExecState */ - NULL /* ProgramName */ + NULL, /* ProgramName */ + GL_FALSE /* JoysticksInitialised */ }; @@ -94,7 +95,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ /* * A call to this function should initialize all the display stuff... */ -void fgInitialize( const char* displayName ) +static void fghInitialize( const char* displayName ) { #if TARGET_HOST_UNIX_X11 fgDisplay.Display = XOpenDisplay( displayName ); @@ -201,11 +202,6 @@ void fgInitialize( const char* displayName ) #endif -#if !TARGET_HOST_WINCE - fgJoystickInit( 0 ); - fgJoystickInit( 1 ); -#endif /* !TARGET_HOST_WINCE */ - fgState.Initialised = GL_TRUE; } @@ -247,8 +243,10 @@ void fgDeinitialize( void ) } #if !TARGET_HOST_WINCE - fgJoystickClose( ); + if ( fgState.JoysticksInitialised ) + fgJoystickClose( ); #endif /* !TARGET_HOST_WINCE */ + fgState.JoysticksInitialised = GL_FALSE; fgState.Initialised = GL_FALSE; @@ -618,7 +616,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) * in the program arguments, we will use the DISPLAY environment * variable for opening the X display (see code above): */ - fgInitialize( displayName ); + fghInitialize( displayName ); /* * Geometry parsing deffered until here because we may need the screen