summaryrefslogtreecommitdiff
path: root/src/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdl')
-rw-r--r--src/sdl/sdl_glimp.c9
-rw-r--r--src/sdl/sdl_input.c16
2 files changed, 24 insertions, 1 deletions
diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c
index cfc10153..f065eb2d 100644
--- a/src/sdl/sdl_glimp.c
+++ b/src/sdl/sdl_glimp.c
@@ -691,6 +691,15 @@ void GLimp_Init( void )
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE );
+ if( Cvar_VariableIntegerValue( "com_abnormalExit" ) )
+ {
+ ri.Cvar_Set( "r_width", va( "%d", R_FAILSAFE_WIDTH ) );
+ ri.Cvar_Set( "r_height", va( "%d", R_FAILSAFE_HEIGHT ) );
+ ri.Cvar_Set( "r_fullscreen", "0" );
+ ri.Cvar_Set( "r_centerWindow", "0" );
+ ri.Cvar_Set( "com_abnormalExit", "0" );
+ }
+
Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" );
Sys_GLimpInit( );
diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c
index ec96b086..0d1164fb 100644
--- a/src/sdl/sdl_input.c
+++ b/src/sdl/sdl_input.c
@@ -949,7 +949,7 @@ static void IN_ProcessEvents( void )
break;
case SDL_QUIT:
- Sys_Quit( );
+ Cbuf_ExecuteText(EXEC_NOW, "quit Closed window\n");
break;
case SDL_VIDEORESIZE:
@@ -965,6 +965,14 @@ static void IN_ProcessEvents( void )
vidRestartTime = Sys_Milliseconds() + 1000;
}
break;
+ case SDL_ACTIVEEVENT:
+ if (e.active.state & SDL_APPINPUTFOCUS) {
+ Cvar_SetValue( "com_unfocused", !e.active.gain);
+ }
+ if (e.active.state & SDL_APPACTIVE) {
+ Cvar_SetValue( "com_minimized", !e.active.gain);
+ }
+ break;
default:
break;
@@ -1034,6 +1042,8 @@ IN_Init
*/
void IN_Init( void )
{
+ int appState;
+
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
@@ -1071,6 +1081,10 @@ void IN_Init( void )
mouseAvailable = qfalse;
}
+ appState = SDL_GetAppState( );
+ Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) );
+ Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
+
IN_InitJoystick( );
Com_DPrintf( "------------------------------------\n" );
}