aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorBastien Bouclet2017-07-29 17:23:27 +0200
committerBastien Bouclet2017-07-29 17:25:37 +0200
commit8c587b54ab92a5f21fae2c1db8ebdedaf61b521e (patch)
tree4bc333c5e56a00a0eba2b3cb989f004b01499a12 /backends/platform
parent12e146616884b51eea9772a2379a8df10578400a (diff)
downloadscummvm-rg350-8c587b54ab92a5f21fae2c1db8ebdedaf61b521e.tar.gz
scummvm-rg350-8c587b54ab92a5f21fae2c1db8ebdedaf61b521e.tar.bz2
scummvm-rg350-8c587b54ab92a5f21fae2c1db8ebdedaf61b521e.zip
SDL: Make the window size when exiting fullscreen workaround macOS specific
The call to SDL_SetWindowSize works around a macOS specific SDL2 bug. Fixes the window not restoring to its previous position when exiting fullscreen on Linux/X11.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl-window.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index bdffa240c3..07ddc998ba 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -253,6 +253,13 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
return false;
}
+#if defined(MACOSX)
+ // macOS windows with the flag SDL_WINDOW_FULLSCREEN_DESKTOP exiting their fullscreen space
+ // ignore the size set by SDL_SetWindowSize while they were in fullscreen mode.
+ // Instead, they revert back to their previous windowed mode size.
+ // This is a bug in SDL2: https://bugzilla.libsdl.org/show_bug.cgi?id=3719.
+ // TODO: Remove the call to SDL_SetWindowSize below once the SDL bug is fixed.
+
// In some cases at this point there may be a pending SDL resize event with the old size.
// This happens for example if we destroyed the window, or when switching between windowed
// and fullscreen modes. If we changed the window size here, this pending event will have the
@@ -260,6 +267,7 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
// resize event (SDL_WINDOWEVENT_SIZE_CHANGED) so that the last resize event we receive has
// the correct size. This fixes for exmample bug #9971: SDL2: Fullscreen to RTL launcher resolution
SDL_SetWindowSize(_window, width, height);
+#endif
_lastFlags = flags;