sdlayer: pass SDL_WINDOW_FULLSCREEN_DESKTOP to SDL_SetWindowFullscreen() when setting a windowed mode that matches the desktop resolution

git-svn-id: https://svn.eduke32.com/eduke32@7204 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-11-18 18:11:38 +00:00
parent 6ef3c4c00f
commit 3b7f41e2bb

View file

@ -1539,6 +1539,11 @@ int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
initprintf("Setting video mode %dx%d (%d-bpp %s)\n", x, y, c, ((fs & 1) ? "fullscreen" : "windowed")); initprintf("Setting video mode %dx%d (%d-bpp %s)\n", x, y, c, ((fs & 1) ? "fullscreen" : "windowed"));
SDL_DisplayMode desktopmode;
SDL_GetDesktopDisplayMode(0, &desktopmode);
int const windowedMode = (desktopmode.w == x && desktopmode.h == y) ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (c > 8 || !nogl) if (c > 8 || !nogl)
{ {
@ -1600,7 +1605,7 @@ int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
return -1; return -1;
} }
SDL_SetWindowFullscreen(sdl_window, ((fs & 1) ? SDL_WINDOW_FULLSCREEN : 0)); SDL_SetWindowFullscreen(sdl_window, ((fs & 1) ? SDL_WINDOW_FULLSCREEN : windowedMode));
SDL_GL_SetSwapInterval(vsync_renderlayer); SDL_GL_SetSwapInterval(vsync_renderlayer);
setrefreshrate(); setrefreshrate();
@ -1625,7 +1630,7 @@ int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
SDL2_VIDEO_ERR("SDL_GetWindowSurface"); SDL2_VIDEO_ERR("SDL_GetWindowSurface");
} }
SDL_SetWindowFullscreen(sdl_window, ((fs & 1) ? SDL_WINDOW_FULLSCREEN : 0)); SDL_SetWindowFullscreen(sdl_window, ((fs & 1) ? SDL_WINDOW_FULLSCREEN : windowedMode));
} }
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1"); SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");