aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorThierry Crozat2017-07-27 21:05:27 +0100
committerThierry Crozat2017-07-27 21:05:44 +0100
commit00bbb73ce584ad262bccbf25c082d33627ba4911 (patch)
treec58077a091866d2aabb7908c6fb968d28cbb7250 /backends/platform/sdl
parent013b09fa2845b060f7adf8eb737fd89b4810223c (diff)
downloadscummvm-rg350-00bbb73ce584ad262bccbf25c082d33627ba4911.tar.gz
scummvm-rg350-00bbb73ce584ad262bccbf25c082d33627ba4911.tar.bz2
scummvm-rg350-00bbb73ce584ad262bccbf25c082d33627ba4911.zip
SDL: Make sure we get the correct window size with SDL2
When updating or recreating the window, if we changed the window size at the same time we also toggle between OpenGL and non OpenGL mode, or toggle fullscreen mode, we may have a pending SDL resize event with the wrong size. So we need to make sure to append another one with the correct size to end up with the correct size. This fixes bug #9971.
Diffstat (limited to 'backends/platform/sdl')
-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 c48876a002..bdffa240c3 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -253,6 +253,14 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
return false;
}
+ // 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
+ // old (and incorrect) size. To avoid any issue we call SDL_SetWindowSize() to generate another
+ // 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);
+
_lastFlags = flags;
return true;