summaryrefslogtreecommitdiff
path: root/src/sdl/sdl_input.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 15:17:16 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:38 +0000
commit6d2ffb4c637a49983bc6ce22b68ccec0ed09e0f4 (patch)
treeff15343e4a2ae5a2512c1c21e05a3821a46f10da /src/sdl/sdl_input.c
parente9e52d0b7ec9bae071534df7581126d69d3e9bf8 (diff)
* Merge ioq3-r1637
Diffstat (limited to 'src/sdl/sdl_input.c')
-rw-r--r--src/sdl/sdl_input.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c
index 3263932a..2949c8fd 100644
--- a/src/sdl/sdl_input.c
+++ b/src/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)
/*
@@ -949,6 +951,20 @@ 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_width", width );
+ ri.Cvar_Set( "r_height", height );
+ /* 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;
}
@@ -1001,6 +1017,13 @@ void IN_Frame( void )
SDL_GetMouseState( &x, &y );
IN_SetUIMousePosition( x, y );
}
+
+ // In case we had to delay actual restart of video system
+ if( ( vidRestartTime != 0 ) && ( vidRestartTime < Sys_Milliseconds( ) ) )
+ {
+ vidRestartTime = 0;
+ Cbuf_AddText( "vid_restart" );
+ }
}
/*