summaryrefslogtreecommitdiff
path: root/src/sdl/sdl_glimp.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-11-16 00:23:28 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:20 +0000
commit21674b587ca1aa1e956b66ae6e613d5afb2111d3 (patch)
treeef74238d6371114ac0f773eacd209f728225ffb9 /src/sdl/sdl_glimp.c
parentd22e46c9afdaf65a06ed0836d4f7e2b9e689e4d9 (diff)
* Merge ioq3-r1752
Diffstat (limited to 'src/sdl/sdl_glimp.c')
-rw-r--r--src/sdl/sdl_glimp.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c
index 58e9c7ed..8028eb59 100644
--- a/src/sdl/sdl_glimp.c
+++ b/src/sdl/sdl_glimp.c
@@ -73,6 +73,7 @@ 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_centerWindow;
cvar_t *r_sdlDriver;
void (APIENTRYP qglActiveTextureARB) (GLenum texture);
@@ -133,9 +134,10 @@ static int GLimp_CompareModes( const void *a, const void *b )
else if( aspectDiffsDiff < -ASPECT_EPSILON )
return -1;
else
- return areaA - areaB;
+ return areaA - areaB;
}
+
/*
===============
GLimp_DetectAvailableModes
@@ -193,7 +195,7 @@ static void GLimp_DetectAvailableModes(void)
GLimp_SetMode
===============
*/
-static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen )
+static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen, qboolean noborder )
{
const char* glstring;
int sdlcolorbits;
@@ -267,7 +269,12 @@ static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen )
glConfig.isFullscreen = qtrue;
}
else
+ {
+ if (noborder)
+ flags |= SDL_NOFRAME;
+
glConfig.isFullscreen = qfalse;
+ }
colorbits = r_colorbits->value;
if ((!colorbits) || (colorbits >= 32))
@@ -446,7 +453,7 @@ static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen )
GLimp_StartDriverAndSetMode
===============
*/
-static qboolean GLimp_StartDriverAndSetMode( qboolean failSafe, qboolean fullscreen )
+static qboolean GLimp_StartDriverAndSetMode( qboolean failSafe, qboolean fullscreen, qboolean noborder )
{
rserr_t err;
@@ -474,7 +481,7 @@ static qboolean GLimp_StartDriverAndSetMode( qboolean failSafe, qboolean fullscr
fullscreen = qfalse;
}
- err = GLimp_SetMode( failSafe, fullscreen );
+ err = GLimp_SetMode( failSafe, fullscreen, noborder );
switch ( err )
{
@@ -681,21 +688,24 @@ 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 );
+ r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE );
+
+ Sys_SetEnv( "SDL_VIDEO_CENTERED", r_centerWindow->integer ? "1" : "" );
Sys_GLimpInit( );
// Create the window and set up the context
- if( GLimp_StartDriverAndSetMode( qfalse, r_fullscreen->integer ) )
+ if( GLimp_StartDriverAndSetMode( qfalse, r_fullscreen->integer, r_noborder->integer ) )
goto success;
// Try again, this time in a platform specific "safe mode"
Sys_GLimpSafeInit( );
- if( GLimp_StartDriverAndSetMode( qfalse, r_fullscreen->integer ) )
+ if( GLimp_StartDriverAndSetMode( qfalse, r_fullscreen->integer, qfalse ) )
goto success;
// Finally, try the default screen resolution
- if( GLimp_StartDriverAndSetMode( qtrue, r_fullscreen->integer ) )
+ if( GLimp_StartDriverAndSetMode( qtrue, r_fullscreen->integer, qfalse ) )
goto success;
// Nothing worked, give up