From c7392f2c3f51443c01bcc439aadcd534d2cd05c2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 1 Sep 2005 05:09:21 +0000 Subject: [PATCH] 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. --- 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 0fd54406..08c20bd7 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 652daa2a..d11c42d5 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 ebf4684c..91397ac0 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. }