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.
This commit is contained in:
Ryan C. Gordon 2005-09-01 05:09:21 +00:00
parent 136557954c
commit c7392f2c3f
3 changed files with 18 additions and 11 deletions

View file

@ -1408,6 +1408,8 @@ void GLimp_Init( void )
InitSig(); InitSig();
IN_Init(); // rcg08312005 moved into glimp.
// Hack here so that if the UI // Hack here so that if the UI
if ( *r_previousglDriver->string ) if ( *r_previousglDriver->string )
{ {

View file

@ -452,15 +452,8 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
*/ */
void GLimp_Shutdown( void ) void GLimp_Shutdown( void )
{ {
IN_DeactivateMouse(); IN_Shutdown();
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if (stick)
{
SDL_JoystickClose(stick);
stick = NULL;
}
SDL_Quit();
screen = NULL; screen = NULL;
memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glConfig, 0, sizeof( glConfig ) );
@ -886,6 +879,8 @@ void GLimp_Init( void )
InitSig(); InitSig();
IN_Init(); // rcg08312005 moved into glimp.
// Hack here so that if the UI // Hack here so that if the UI
if ( *r_previousglDriver->string ) if ( *r_previousglDriver->string )
{ {
@ -1209,7 +1204,17 @@ void IN_Init(void) {
void IN_Shutdown(void) void IN_Shutdown(void)
{ {
IN_DeactivateMouse();
mouse_avail = qfalse; mouse_avail = qfalse;
if (stick)
{
SDL_JoystickClose(stick);
stick = NULL;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
} }
void IN_Frame (void) { void IN_Frame (void) {

View file

@ -399,7 +399,7 @@ void Sys_Init(void)
Cvar_Set( "username", Sys_GetCurrentUser() ); Cvar_Set( "username", Sys_GetCurrentUser() );
IN_Init(); //IN_Init(); // rcg08312005 moved into glimp.
} }