From 7b8af113daa511f986769ed021c1bec69c1134ff Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 13 Dec 2015 20:50:35 -0400 Subject: [PATCH] Fixed the minimum window size to re-set itself when love.window.setFullscreen(false) is called. --- src/modules/window/sdl/Window.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 25fdc9b4e..178827ea2 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -551,14 +551,9 @@ void Window::updateSettings(const WindowSettings &newsettings) curMode.settings.fullscreen = love::android::getImmersive(); #endif - // The min width/height is set to 0 internally in SDL when in fullscreen. - if (curMode.settings.fullscreen) - { - curMode.settings.minwidth = newsettings.minwidth; - curMode.settings.minheight = newsettings.minheight; - } - else - SDL_GetWindowMinimumSize(window, &curMode.settings.minwidth, &curMode.settings.minheight); + // SDL_GetWindowMinimumSize gives back 0,0 sometimes... + curMode.settings.minwidth = newsettings.minwidth; + curMode.settings.minheight = newsettings.minheight; curMode.settings.resizable = (wflags & SDL_WINDOW_RESIZABLE) != 0; curMode.settings.borderless = (wflags & SDL_WINDOW_BORDERLESS) != 0; @@ -664,6 +659,10 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype) SDL_GL_MakeCurrent(window, context); updateSettings(newsettings); + // Apparently this gets un-set when we exit fullscreen (at least in OS X). + if (!fullscreen) + SDL_SetWindowMinimumSize(window, curMode.settings.minwidth, curMode.settings.minheight); + // Update the viewport size now instead of waiting for event polling. auto gfx = Module::getInstance(Module::M_GRAPHICS); if (gfx != nullptr)