love.window.setFullscreen(true, "exclusive") always uses the desktop's display mode.

This avoids switching the display mode when toggling fullscreen or alt-tabbing, after toggling fullscreen.
This commit is contained in:
Sasha Szpakowski
2026-05-29 22:05:22 -03:00
parent 06e8da722c
commit 83ebf679b5
+6 -5
View File
@@ -853,7 +853,6 @@ bool Window::setFullscreen(bool fullscreen, FullscreenType fstype)
newsettings.fullscreen = fullscreen;
newsettings.fstype = fstype;
bool sdlflags = fullscreen;
if (fullscreen)
{
if (fstype == FULLSCREEN_DESKTOP)
@@ -861,9 +860,11 @@ bool Window::setFullscreen(bool fullscreen, FullscreenType fstype)
else
{
SDL_DisplayID displayid = SDL_GetDisplayForWindow(window);
SDL_DisplayMode mode = {};
if (SDL_GetClosestFullscreenDisplayMode(displayid, windowWidth, windowHeight, 0, isHighDPIAllowed(), &mode))
SDL_SetWindowFullscreenMode(window, &mode);
const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(displayid);
if (mode != nullptr)
SDL_SetWindowFullscreenMode(window, mode);
else
return false;
}
}
@@ -871,7 +872,7 @@ bool Window::setFullscreen(bool fullscreen, FullscreenType fstype)
love::android::setImmersive(fullscreen);
#endif
if (SDL_SetWindowFullscreen(window, sdlflags))
if (SDL_SetWindowFullscreen(window, fullscreen))
{
if (glcontext)
SDL_GL_MakeCurrent(window, glcontext);