diff options
Diffstat (limited to 'code')
-rw-r--r-- | code/client/cl_keys.c | 38 | ||||
-rw-r--r-- | code/renderer/tr_init.c | 4 | ||||
-rw-r--r-- | code/unix/sdl_glimp.c | 28 |
3 files changed, 48 insertions, 22 deletions
diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c index a14b5ce..6f0dece 100644 --- a/code/client/cl_keys.c +++ b/code/client/cl_keys.c @@ -1043,28 +1043,22 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) { } #ifndef _WIN32 - if (key == K_ENTER) - { - if (down) - { - if (keys[K_ALT].down) - { - Key_ClearStates(); - if (Cvar_VariableValue("r_fullscreen") == 0) - { - Com_Printf("Switching to fullscreen rendering\n"); - Cvar_Set("r_fullscreen", "1"); - } - else - { - Com_Printf("Switching to windowed rendering\n"); - Cvar_Set("r_fullscreen", "0"); - } - Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n"); - return; - } - } - } + if (key == K_ENTER) + { + if (down) + { + if (keys[K_ALT].down) + { + Key_ClearStates(); + Cvar_SetValue( "r_fullscreen", + !Cvar_VariableIntegerValue( "r_fullscreen" ) ); +#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame + Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n"); +#endif + return; + } + } + } #endif // console key is hardcoded, so the user can never unbind it diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c index 285ed18..70b969c 100644 --- a/code/renderer/tr_init.c +++ b/code/renderer/tr_init.c @@ -926,7 +926,11 @@ void R_Register( void ) r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH); r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH ); +#if USE_SDL_VIDEO + r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE ); +#else r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH ); +#endif r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH ); r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH ); r_customaspect = ri.Cvar_Get( "r_customaspect", "1", CVAR_ARCHIVE | CVAR_LATCH ); diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c index 75dc010..db77e14 100644 --- a/code/unix/sdl_glimp.c +++ b/code/unix/sdl_glimp.c @@ -1040,6 +1040,34 @@ void GLimp_EndFrame (void) SDL_GL_SwapBuffers(); } + if( r_fullscreen->modified ) + { + qboolean fullscreen; + qboolean sdlToggled = qfalse; + SDL_Surface *s = SDL_GetVideoSurface( ); + + if( s ) + { + // Find out the current state + if( s->flags & SDL_FULLSCREEN ) + fullscreen = qtrue; + else + fullscreen = qfalse; + + // Is the state we want different from the current state? + if( !!r_fullscreen->integer != fullscreen ) + sdlToggled = SDL_WM_ToggleFullScreen( s ); + else + sdlToggled = qtrue; + } + + // SDL_WM_ToggleFullScreen didn't work, so do it the slow way + if( !sdlToggled ) + Cbuf_AddText( "vid_restart" ); + + r_fullscreen->modified = qfalse; + } + // check logging QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value } |