diff --git a/src/dedicated/i_video.c b/src/dedicated/i_video.c index 6c0b6644a..8f8781e9e 100644 --- a/src/dedicated/i_video.c +++ b/src/dedicated/i_video.c @@ -152,3 +152,8 @@ boolean I_UseNativeKeyboard(void) { return false; } + +void I_SetBorderlessWindow(void) +{ + +} diff --git a/src/i_video.h b/src/i_video.h index 68042a654..88d295ed9 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -145,6 +145,8 @@ boolean I_UseNativeKeyboard(void); boolean I_CheckNativeRes(void); +void I_SetBorderlessWindow(void); + #ifdef USE_FBO_OGL void RefreshOGLSDLSurface(void); diff --git a/src/screen.c b/src/screen.c index eb6c2bc82..a8a3ca78b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -66,7 +66,9 @@ static void Highreshudscale_OnChange(void) static void SCR_ChangeFullscreen (void); -consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t fullscreen_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Borderless Window"}, {0, NULL}}; + +consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, fullscreen_cons_t, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}}; consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -325,6 +327,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.c b/src/sdl/i_video.c index f4a2c288c..fa55e62f1 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -150,7 +150,7 @@ UINT8 graphics_started = 0; // Is used in console.c and screen.c // To disable fullscreen at startup; is set in VID_PrepareModeList boolean allow_fullscreen = false; static SDL_bool disable_fullscreen = SDL_FALSE; -#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value +#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)? 0: (cv_fullscreen.value == 1) static SDL_bool disable_mouse = SDL_FALSE; #define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus) #define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN) @@ -1353,6 +1353,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) { wasfullscreen = SDL_TRUE; SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); + I_SetBorderlessWindow(); } else // windowed mode { @@ -2157,4 +2158,10 @@ static void Impl_SetVsync(void) #endif } +void I_SetBorderlessWindow(void) +{ + SDL_bool borderless = (cv_fullscreen.value == 2) ? SDL_FALSE : SDL_TRUE; + SDL_SetWindowBordered(window, borderless); +} + #endif