diff --git a/src/i_video.h b/src/i_video.h index 796b5c334..4bebe7c81 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -153,6 +153,8 @@ void I_EndRead(void); UINT32 I_GetRefreshRate(void); +void I_SetBorderlessWindow(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/screen.c b/src/screen.c index a32e01737..dc8c09607 100644 --- a/src/screen.c +++ b/src/screen.c @@ -80,7 +80,8 @@ consvar_t cv_renderer = CVAR_INIT ("renderer", "Software", CV_SAVE|CV_NOLUA|CV_C static void SCR_ChangeFullscreen(void); -consvar_t cv_fullscreen = CVAR_INIT ("fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen); +static CV_PossibleValue_t fullscreen_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Borderless Window"}, {0, NULL}}; +consvar_t cv_fullscreen = CVAR_INIT ("fullscreen", "Yes", CV_SAVE|CV_CALL, fullscreen_cons_t, SCR_ChangeFullscreen); // ========================================================================= // SCREEN VARIABLES @@ -449,6 +450,8 @@ void SCR_SetDefaultMode(void) void SCR_ChangeFullscreen(void) { #ifdef DIRECTFULLSCREEN + I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup + // allow_fullscreen is set by VID_PrepareModeList // it is used to prevent switching to fullscreen during startup if (!allow_fullscreen) diff --git a/src/sdl/i_video.cpp b/src/sdl/i_video.cpp index 4f80e2be5..fc3f5fe4f 100644 --- a/src/sdl/i_video.cpp +++ b/src/sdl/i_video.cpp @@ -110,7 +110,7 @@ UINT8 graphics_started = 0; // Is used in console.c and screen.c boolean allow_fullscreen = false; static SDL_bool disable_fullscreen = SDL_FALSE; -#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?static_cast(0):static_cast(cv_fullscreen.value) +#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?static_cast(0):static_cast(cv_fullscreen.value == 1) static SDL_bool disable_mouse = SDL_FALSE; #define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus) @@ -380,6 +380,7 @@ static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_b { wasfullscreen = SDL_TRUE; SDL_SetWindowFullscreen(window, fullscreen_type); + I_SetBorderlessWindow(); } else // windowed mode { @@ -1906,7 +1907,6 @@ void I_ShutdownGraphics(void) SDL_QuitSubSystem(SDL_INIT_VIDEO); framebuffer = SDL_FALSE; } -#endif UINT32 I_GetRefreshRate(void) { @@ -1917,3 +1917,12 @@ UINT32 I_GetRefreshRate(void) // trouble querying mode over and over again. return refresh_rate; } + +void I_SetBorderlessWindow(void) +{ + SDL_bool borderless = (cv_fullscreen.value == 2) ? SDL_FALSE : SDL_TRUE; + SDL_SetWindowBordered(window, borderless); +} +#endif + +