diff --git a/contributors.md b/contributors.md index d8f9efcb52..b3791771d2 100644 --- a/contributors.md +++ b/contributors.md @@ -75,6 +75,7 @@ Includes all git commit authors. Aliases are GitHub user names. * Daniel Trujillo Viedma (gDanix) * Jonathan Haas (HaasJona) * Jake Breen (Haekb) +* Marco Benzi Tobar (Lisergishnu) ## Toolchain * (Balletie) - macOS diff --git a/src/openrct2/platform/linux.c b/src/openrct2/platform/linux.c index 57a2dc102b..4a3be91bc9 100644 --- a/src/openrct2/platform/linux.c +++ b/src/openrct2/platform/linux.c @@ -569,4 +569,9 @@ bool platform_get_font_path(TTFFontDescriptor *font, utf8 *buffer, size_t size) } #endif // NO_TTF +sint32 platform_get_non_window_flags() +{ + return SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP; +} + #endif diff --git a/src/openrct2/platform/macos.m b/src/openrct2/platform/macos.m index 1aa20ff358..b70fbf2bce 100644 --- a/src/openrct2/platform/macos.m +++ b/src/openrct2/platform/macos.m @@ -279,4 +279,9 @@ uint8 platform_get_locale_measurement_format() } } +sint32 platform_get_non_window_flags() +{ + return SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP; +} + #endif diff --git a/src/openrct2/platform/platform.h b/src/openrct2/platform/platform.h index f835123d85..97dc5cab79 100644 --- a/src/openrct2/platform/platform.h +++ b/src/openrct2/platform/platform.h @@ -239,4 +239,9 @@ void core_init(); void macos_disallow_automatic_window_tabbing(); #endif +// On macOS the resizing behaviour effectively resizes the window in the same +// way a normal drag would do, given constraints in the user desktop (e.g. the dock +// positioning). So it follows that the finished window size should be saved. +sint32 platform_get_non_window_flags(); + #endif diff --git a/src/openrct2/platform/shared.c b/src/openrct2/platform/shared.c index cfdb45517d..7ffa712ae1 100644 --- a/src/openrct2/platform/shared.c +++ b/src/openrct2/platform/shared.c @@ -194,9 +194,7 @@ static void platform_resize(sint32 width, sint32 height) // Check if the window has been resized in windowed mode and update the config file accordingly // This is called in rct2_update and is only called after resizing a window has finished - const sint32 nonWindowFlags = - SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP; - if (!(flags & nonWindowFlags)) { + if (!(flags & platform_get_non_window_flags())) { if (width != gConfigGeneral.window_width || height != gConfigGeneral.window_height) { gConfigGeneral.window_width = width; gConfigGeneral.window_height = height; diff --git a/src/openrct2/platform/windows.c b/src/openrct2/platform/windows.c index 520df12bd4..fe3bfef5e2 100644 --- a/src/openrct2/platform/windows.c +++ b/src/openrct2/platform/windows.c @@ -1237,4 +1237,9 @@ bool platform_setup_uri_protocol() /////////////////////////////////////////////////////////////////////////////// +sint32 platform_get_non_window_flags() +{ + return SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP; +} + #endif