aboutsummaryrefslogtreecommitdiffstats
path: root/code/sdl
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-14 22:07:34 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-14 22:07:34 +0000
commit83165ea05edee6ed7ee33f951e90bfbdadb977f8 (patch)
treef0dc32d6b970a57aa1fac6e513ecbe69baa11aaf /code/sdl
parent305fe12335ab67ced717eb1d223f16eaa4b194ab (diff)
downloadioquake3-aero-83165ea05edee6ed7ee33f951e90bfbdadb977f8.tar.gz
ioquake3-aero-83165ea05edee6ed7ee33f951e90bfbdadb977f8.zip
Allow optional window resizing.
Fixes Bugzilla #2844. git-svn-id: svn://svn.icculus.org/quake3/trunk@1594 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sdl')
-rw-r--r--code/sdl/sdl_glimp.c5
-rw-r--r--code/sdl/sdl_input.c24
2 files changed, 29 insertions, 0 deletions
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index ba08ade..59c1e53 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -79,6 +79,7 @@ static SDL_Surface *screen = NULL;
static const SDL_VideoInfo *videoInfo = NULL;
cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
+cvar_t *r_allowResize; // make window resizable
cvar_t *r_sdlDriver;
void (APIENTRYP qglActiveTextureARB) (GLenum texture);
@@ -215,6 +216,9 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
ri.Printf( PRINT_ALL, "Initializing OpenGL display\n");
+ if ( r_allowResize->integer )
+ flags |= SDL_RESIZABLE;
+
#if !SDL_VERSION_ATLEAST(1, 2, 10)
// 1.2.10 is needed to get the desktop resolution
displayAspect = 4.0f / 3.0f;
@@ -667,6 +671,7 @@ void GLimp_Init( void )
{
r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
+ r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
Sys_GLimpInit( );
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" );
+ }
}
/*