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).
This commit is contained in:
Thierry Crozat 2022-06-05 17:54:23 +01:00
parent 56409e3a44
commit f95bf24fd1

View file

@ -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