diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 9cdd3eb3..d3a5dafd 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -109,6 +109,7 @@ cvar_t *r_swapInterval; cvar_t *r_glDriver; #else cvar_t *r_sdlDriver; +cvar_t *r_sdlAllowScreenSaver; #endif cvar_t *r_displayRefresh; cvar_t *r_fullscreen; @@ -4309,6 +4310,8 @@ static void CL_InitGLimp_Cvars( void ) #else r_sdlDriver = Cvar_Get( "r_sdlDriver", "", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_UNSAFE ); Cvar_SetDescription( r_sdlDriver, "Override hint to SDL which video driver to use, example \"x11\" or \"wayland\"" ); + r_sdlAllowScreenSaver = Cvar_Get( "r_sdlAllowScreenSaver", "0", CVAR_ARCHIVE_ND | CVAR_LATCH | CVAR_UNSAFE ); + Cvar_SetDescription( r_sdlAllowScreenSaver, "Allow screen to sleep while the game is running, requires full restart"); #endif r_displayRefresh = Cvar_Get( "r_displayRefresh", "0", CVAR_LATCH | CVAR_UNSAFE ); diff --git a/src/client/client.h b/src/client/client.h index 8478b2e1..805ffc33 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -522,6 +522,7 @@ extern cvar_t *r_swapInterval; extern cvar_t *r_glDriver; #else extern cvar_t *r_sdlDriver; +extern cvar_t *r_sdlAllowScreenSaver; #endif extern cvar_t *r_displayRefresh; extern cvar_t *r_fullscreen; diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c index a213208b..e7268598 100644 --- a/src/sdl/sdl_glimp.c +++ b/src/sdl/sdl_glimp.c @@ -551,6 +551,11 @@ static rserr_t GLimp_StartDriverAndSetMode( int mode, const char *modeFS, qboole fullscreen = qfalse; } + if ( r_sdlAllowScreenSaver->integer ) + { + SDL_SetHint( SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1" ); + } + if ( !SDL_WasInit( SDL_INIT_VIDEO ) ) { const char *driverName;