diff --git a/src/backends/sdl/refresh.c b/src/backends/sdl/refresh.c index b43f0bbf..298186df 100644 --- a/src/backends/sdl/refresh.c +++ b/src/backends/sdl/refresh.c @@ -510,7 +510,13 @@ GLimp_InitGraphics(qboolean fullscreen) /* If we want fullscreen, but aren't */ if (fullscreen != IsFullscreen()) { - GLimp_ToggleFullscreen(); +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_SetWindowFullscreen(window, fullscreen ? SDL_WINDOW_FULLSCREEN : 0); +#else + SDL_WM_ToggleFullScreen(window); +#endif + + Cvar_SetValue("vid_fullscreen", fullscreen); } /* Are we now? */ @@ -705,31 +711,6 @@ GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen) return rserr_ok; } -/* - * Toggle fullscreen. - */ -void GLimp_ToggleFullscreen(void) -{ -#if SDL_VERSION_ATLEAST(2, 0, 0) - int wantFullscreen = !IsFullscreen(); - - SDL_SetWindowFullscreen(window, wantFullscreen ? SDL_WINDOW_FULLSCREEN : 0); - Cvar_SetValue("vid_fullscreen", wantFullscreen); -#else - SDL_WM_ToggleFullScreen(window); - - if (IsFullscreen()) - { - Cvar_SetValue("vid_fullscreen", 1); - } - else - { - Cvar_SetValue("vid_fullscreen", 0); - } -#endif - vid_fullscreen->modified = false; -} - /* * (Un)grab Input */ diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c index d6056020..4d5e155f 100644 --- a/src/client/cl_keyboard.c +++ b/src/client/cl_keyboard.c @@ -909,6 +909,7 @@ Key_Event(int key, qboolean down, qboolean special) { char cmd[1024]; char *kb; + cvar_t *fullscreen; unsigned int time = Sys_Milliseconds(); /* Track if key is down */ @@ -938,7 +939,19 @@ Key_Event(int key, qboolean down, qboolean special) /* Fullscreen switch through Alt + Return */ if (down && keydown[K_ALT] && key == K_ENTER) { - GLimp_ToggleFullscreen(); + fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE); + + if (!fullscreen->value) + { + fullscreen->value = 1; + fullscreen->modified = true; + } + else + { + fullscreen->value = 0; + fullscreen->modified = true; + } + return; } diff --git a/src/client/refresh/header/local.h b/src/client/refresh/header/local.h index befa1776..af213fe8 100644 --- a/src/client/refresh/header/local.h +++ b/src/client/refresh/header/local.h @@ -429,11 +429,6 @@ int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen); */ void *GLimp_GetProcAddress (const char* proc); -/* - * Toggle fullscreen. - */ -void GLimp_ToggleFullscreen(void); - /* * (Un)grab Input */