From e7067a0011612692677189db92a657ab88335721 Mon Sep 17 00:00:00 2001 From: icculus Date: Thu, 1 Sep 2005 05:09:21 +0000 Subject: Screw with (de)initialization code. This fixes: - Mouse grab being lost after alt-enter goes windowed in the SDL driver. - Joystick ceasing to function on vid_restart in the SDL driver. - Audio failing to work after after snd_restart in the SDL driver. - Probably other things. git-svn-id: svn://svn.icculus.org/quake3/trunk@62 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/unix/linux_glimp.c | 2 ++ code/unix/sdl_glimp.c | 25 +++++++++++++++---------- code/unix/unix_main.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/unix/linux_glimp.c b/code/unix/linux_glimp.c index 0fd5440..08c20bd 100644 --- a/code/unix/linux_glimp.c +++ b/code/unix/linux_glimp.c @@ -1408,6 +1408,8 @@ void GLimp_Init( void ) InitSig(); + IN_Init(); // rcg08312005 moved into glimp. + // Hack here so that if the UI if ( *r_previousglDriver->string ) { diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c index 652daa2..d11c42d 100644 --- a/code/unix/sdl_glimp.c +++ b/code/unix/sdl_glimp.c @@ -404,7 +404,7 @@ void KBD_Close(void) void IN_ActivateMouse( void ) { if (!mouse_avail || !screen) - return; + return; if (!mouse_active) { @@ -452,15 +452,8 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned */ void GLimp_Shutdown( void ) { - IN_DeactivateMouse(); - - if (stick) - { - SDL_JoystickClose(stick); - stick = NULL; - } - - SDL_Quit(); + IN_Shutdown(); + SDL_QuitSubSystem(SDL_INIT_VIDEO); screen = NULL; memset( &glConfig, 0, sizeof( glConfig ) ); @@ -886,6 +879,8 @@ void GLimp_Init( void ) InitSig(); + IN_Init(); // rcg08312005 moved into glimp. + // Hack here so that if the UI if ( *r_previousglDriver->string ) { @@ -1209,7 +1204,17 @@ void IN_Init(void) { void IN_Shutdown(void) { + IN_DeactivateMouse(); + mouse_avail = qfalse; + + if (stick) + { + SDL_JoystickClose(stick); + stick = NULL; + } + + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } void IN_Frame (void) { diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c index ebf4684..91397ac 100644 --- a/code/unix/unix_main.c +++ b/code/unix/unix_main.c @@ -399,7 +399,7 @@ void Sys_Init(void) Cvar_Set( "username", Sys_GetCurrentUser() ); - IN_Init(); + //IN_Init(); // rcg08312005 moved into glimp. } -- cgit v1.2.3