From f95bf24fd1aaab440c75c1fb1e0badcbe3cc20d5 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 5 Jun 2022 17:54:23 +0100 Subject: [PATCH] MACOSX: Fix issue with restoring maximized window The SdlWindow::createOrUpdateWindow makes sure the created window is not bigger than the desktop. When not in fullscreen, the window borders are also considered, but on macOS a maximimized window is borderless, so this resulted in maximized window being restored smaller than they should have (and no longer maximized). --- backends/platform/sdl/sdl-window.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp index 910b5eb9550..07264cf120a 100644 --- a/backends/platform/sdl/sdl-window.cpp +++ b/backends/platform/sdl/sdl-window.cpp @@ -368,8 +368,15 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) { // basically worthless. So we'll just try to keep things closeish to the // maximum for now. Common::Rect desktopRes = getDesktopResolution(); - if (!fullscreenFlags) { + if ( + !fullscreenFlags +#if defined(MACOSX) + // On macOS a maximized window is borderless + && !(flags & SDL_WINDOW_MAXIMIZED) +#endif + ) { int top, left, bottom, right; + #if SDL_VERSION_ATLEAST(2, 0, 5) if (!_window || SDL_GetWindowBordersSize(_window, &top, &left, &bottom, &right) < 0) #endif