[Scummvm-git-logs] scummvm master -> 00bbb73ce584ad262bccbf25c082d33627ba4911

criezy criezy at scummvm.org
Thu Jul 27 22:12:18 CEST 2017


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

Summary:
013b09fa28 COMMON: Only clear events from the EventSources in clearEvents()
00bbb73ce5 SDL: Make sure we get the correct window size with SDL2


Commit: 013b09fa2845b060f7adf8eb737fd89b4810223c
    https://github.com/scummvm/scummvm/commit/013b09fa2845b060f7adf8eb737fd89b4810223c
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-07-27T21:05:43+01:00

Commit Message:
COMMON: Only clear events from the EventSources in clearEvents()

Changed paths:
    common/EventDispatcher.cpp


diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index b81db6f..5c8a9a3 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -76,8 +76,6 @@ void EventDispatcher::clearEvents() {
 	for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) {
 		while (i->source->pollEvent(event)) {}
 	}
-
-	List<Event> delayedEvents = _mapper->getDelayedEvents();
 }
 
 


Commit: 00bbb73ce584ad262bccbf25c082d33627ba4911
    https://github.com/scummvm/scummvm/commit/00bbb73ce584ad262bccbf25c082d33627ba4911
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-07-27T21:05:44+01:00

Commit Message:
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.

Changed paths:
    backends/events/sdl/sdl-events.cpp
    backends/platform/sdl/sdl-window.cpp


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 946a1af..fb5a4c9 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -589,7 +589,18 @@ bool SdlEventSource::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) {
 				_graphicsManager->notifyVideoExpose();
 			return false;
 
-		case SDL_WINDOWEVENT_RESIZED:
+		// SDL2 documentation indicate that SDL_WINDOWEVENT_SIZE_CHANGED is sent either as a result
+		// of the size being changed by an external event (for example the user resizing the window
+		// or going fullscreen) or a call to the SDL API (for example SDL_SetWindowSize). On the
+		// other hand SDL_WINDOWEVENT_RESIZED is only sent for resize resulting from an external event,
+		// and is always preceded by a SDL_WINDOWEVENT_SIZE_CHANGED event.
+		// We need to handle the programmatic resize as well so that the graphics manager always know
+		// the current size. See comments in SdlWindow::createOrUpdateWindow for details of one case
+		// where we need to call SDL_SetWindowSize and we need the resulting event to be processed.
+		// However if the documentation is correct we can ignore SDL_WINDOWEVENT_RESIZED since when we
+		// get one we should always get a SDL_WINDOWEVENT_SIZE_CHANGED as well.
+		case SDL_WINDOWEVENT_SIZE_CHANGED:
+		//case SDL_WINDOWEVENT_RESIZED:
 			return handleResizeEvent(event, ev.window.data1, ev.window.data2);
 
 		default:
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index c48876a..bdffa24 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;





More information about the Scummvm-git-logs mailing list