[Scummvm-git-logs] scummvm master -> 1fd4dbfdce66bc515e43c062e5b142e33391b131

criezy criezy at scummvm.org
Sun Sep 18 05:28:32 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1fd4dbfdce SDL: Ignore outdated SDL resize event in OpenGL mode


Commit: 1fd4dbfdce66bc515e43c062e5b142e33391b131
    https://github.com/scummvm/scummvm/commit/1fd4dbfdce66bc515e43c062e5b142e33391b131
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-09-18T04:23:37+01:00

Commit Message:
SDL: Ignore outdated SDL resize event in OpenGL mode

Those outdated resize events are sent from SDL_DestroyWindow when the
window is fullscreen and doesn't have the SDL_WINDOW_FULLSCREEN_DESKTOP
flag (thus Surface SDL is not affected). Switching resolutions in fullscreen, or
switching from fullscreen to windowed will therefore cause a resize event to
be received with the former fullscreen resolution after we have already setup
the window to use the new resolution. If we don't ignore this event we end up
with a texture size and a window size that are not consistent and for example
see only a part of the texture (if the old resolution is bigger than the new one.

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp



diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 7ea1860..33c82b9 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -348,6 +348,17 @@ void OpenGLSdlGraphicsManager::notifyVideoExpose() {
 
 void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height) {
 #if SDL_VERSION_ATLEAST(2, 0, 0)
+	// We sometime get outdated resize events from SDL2. So check that the size we get
+	// is the actual current window size. If not ignore the resize.
+	// The issue for example occurs when switching from fullscreen to windowed mode or
+	// when switching between different fullscreen resolutions because SDL_DestroyWindow
+	// for a fullscreen window that doesn't have the SDL_WINDOW_FULLSCREEN_DESKTOP flag
+	// causes a SDL_WINDOWEVENT_RESIZED event with the old resolution to be sent, and this
+	// event is processed after recreating the window at the new resolution.
+	int currentWidth, currentHeight;
+	getWindowDimensions(&currentWidth, &currentHeight);
+	if (width != currentWidth || height != currentHeight)
+		return;
 	setActualScreenSize(width, height);
 	_eventSource->resetKeyboadEmulation(width - 1, height - 1);
 #else





More information about the Scummvm-git-logs mailing list