summaryrefslogtreecommitdiff
path: root/src/sdl/sdl_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdl/sdl_input.c')
-rw-r--r--src/sdl/sdl_input.c16
1 files changed, 15 insertions, 1 deletions
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" );
}