aboutsummaryrefslogtreecommitdiffstats
path: root/code/sdl/sdl_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/sdl/sdl_input.c')
-rw-r--r--code/sdl/sdl_input.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c
index a74887a..4949dc1 100644
--- a/code/sdl/sdl_input.c
+++ b/code/sdl/sdl_input.c
@@ -70,6 +70,8 @@ static cvar_t *in_joystickDebug = NULL;
static cvar_t *in_joystickThreshold = NULL;
static cvar_t *in_joystickNo = NULL;
+static int vidRestartTime = 0;
+
#define CTRL(a) ((a)-'a'+1)
/*
@@ -901,6 +903,21 @@ static void IN_ProcessEvents( void )
Sys_Quit( );
break;
+ case SDL_VIDEORESIZE:
+ {
+ char width[32], height[32];
+ Com_sprintf( width, sizeof(width), "%d", e.resize.w );
+ Com_sprintf( height, sizeof(height), "%d", e.resize.h );
+ ri.Cvar_Set( "r_customwidth", width );
+ ri.Cvar_Set( "r_customheight", height );
+ ri.Cvar_Set( "r_mode", "-1" );
+ /* wait until user stops dragging for 1 second, so
+ we aren't constantly recreating the GL context while
+ he tries to drag...*/
+ vidRestartTime = Sys_Milliseconds() + 1000;
+ }
+ break;
+
default:
break;
}
@@ -939,6 +956,13 @@ void IN_Frame( void )
}
else
IN_ActivateMouse( );
+
+ /* in case we had to delay actual restart of video system... */
+ if ( (vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()) )
+ {
+ vidRestartTime = 0;
+ Cbuf_AddText( "vid_restart" );
+ }
}
/*