[Scummvm-git-logs] scummvm master -> d6f105e906b14642d1eaada3e86b6f812dc197b1

sev- sev at scummvm.org
Sat Aug 28 08:43:12 UTC 2021


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

Summary:
d07c97f3cd BACKENDS: OPENGLSDL: Remember maximized window state
3da65d47cb BACKENDS: OPENGLSDL: Prevent window resizing events in fullscreen mode
cedd57a4ac BACKENDS: OPENGLSDL: Fix wrong check for maximized windows
1b6c4f48aa BACKENDS: OPENGLSDL: Forcefully center the window to prevent off-screen rendering
4c7bc5effb BACKENDS: OPENGLSDL: Do not try to center window in fullscreen or maximized mode
1b42675e52 BACKENDS: OPENGLSDL: Limit window positioning workaround to Win32
d6f105e906 BACKENDS: OPENGLSDL: Only relocate the window to the center of the screen if truly necessary


Commit: d07c97f3cd96cc94ddbd48465b7247b626e8dac2
    https://github.com/scummvm/scummvm/commit/d07c97f3cd96cc94ddbd48465b7247b626e8dac2
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Remember maximized window state

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 870892d666..445a545033 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -305,9 +305,11 @@ void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) {
 		if (SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_MAXIMIZED) {
 			ConfMan.setInt("window_maximized_width", currentWidth, Common::ConfigManager::kApplicationDomain);
 			ConfMan.setInt("window_maximized_height", currentHeight, Common::ConfigManager::kApplicationDomain);
+			ConfMan.setBool("window_maximized", true, Common::ConfigManager::kApplicationDomain);
 		} else {
 			ConfMan.setInt("last_window_width", currentWidth, Common::ConfigManager::kApplicationDomain);
 			ConfMan.setInt("last_window_height", currentHeight, Common::ConfigManager::kApplicationDomain);
+			ConfMan.setBool("window_maximized", false, Common::ConfigManager::kApplicationDomain);
 		}
 		ConfMan.flushToDisk();
 	}
@@ -513,6 +515,10 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 		flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
 	}
 
+	if (ConfMan.getBool("window_maximized", Common::ConfigManager::kApplicationDomain)) {
+		flags |= SDL_WINDOW_MAXIMIZED;
+	}
+
 	// Request a OpenGL (ES) context we can use.
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, _glContextProfileMask);
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, _glContextMajor);


Commit: 3da65d47cb4bf26d5a6a54b451706dfc81b11682
    https://github.com/scummvm/scummvm/commit/3da65d47cb4bf26d5a6a54b451706dfc81b11682
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Prevent window resizing events in fullscreen mode

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 445a545033..689717b862 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -350,13 +350,13 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	SDL_Window *window = _window->getSDLWindow();
 	bool _isMaximized = window ? (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) : false;
-	if (_isMaximized && ConfMan.hasKey("window_maximized_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("window_maximized_height", Common::ConfigManager::kApplicationDomain)) {
+	if (_isMaximized && !_wantsFullScreen && ConfMan.hasKey("window_maximized_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("window_maximized_height", Common::ConfigManager::kApplicationDomain)) {
 		// Set the window size to the values stored when the window was maximized
 		// for the last time.
 		requestedWidth  = ConfMan.getInt("window_maximized_width", Common::ConfigManager::kApplicationDomain);
 		requestedHeight = ConfMan.getInt("window_maximized_height", Common::ConfigManager::kApplicationDomain);
 
-	} else if (!_isMaximized && ConfMan.hasKey("last_window_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("last_window_height", Common::ConfigManager::kApplicationDomain)) {
+	} else if (!_isMaximized && _wantsFullScreen && ConfMan.hasKey("last_window_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("last_window_height", Common::ConfigManager::kApplicationDomain)) {
 		// Load previously stored window dimensions.
 		requestedWidth  = ConfMan.getInt("last_window_width", Common::ConfigManager::kApplicationDomain);
 		requestedHeight = ConfMan.getInt("last_window_height", Common::ConfigManager::kApplicationDomain);
@@ -515,7 +515,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 		flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
 	}
 
-	if (ConfMan.getBool("window_maximized", Common::ConfigManager::kApplicationDomain)) {
+	if (!_wantsFullScreen && ConfMan.getBool("window_maximized", Common::ConfigManager::kApplicationDomain)) {
 		flags |= SDL_WINDOW_MAXIMIZED;
 	}
 


Commit: cedd57a4acbfbcfff3555f88d8f59760e871ded2
    https://github.com/scummvm/scummvm/commit/cedd57a4acbfbcfff3555f88d8f59760e871ded2
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Fix wrong check for maximized windows

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 689717b862..985965a730 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -356,7 +356,7 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
 		requestedWidth  = ConfMan.getInt("window_maximized_width", Common::ConfigManager::kApplicationDomain);
 		requestedHeight = ConfMan.getInt("window_maximized_height", Common::ConfigManager::kApplicationDomain);
 
-	} else if (!_isMaximized && _wantsFullScreen && ConfMan.hasKey("last_window_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("last_window_height", Common::ConfigManager::kApplicationDomain)) {
+	} else if (!_isMaximized && !_wantsFullScreen && ConfMan.hasKey("last_window_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("last_window_height", Common::ConfigManager::kApplicationDomain)) {
 		// Load previously stored window dimensions.
 		requestedWidth  = ConfMan.getInt("last_window_width", Common::ConfigManager::kApplicationDomain);
 		requestedHeight = ConfMan.getInt("last_window_height", Common::ConfigManager::kApplicationDomain);


Commit: 1b6c4f48aa74b1b193c25239c885d3b95bf173ac
    https://github.com/scummvm/scummvm/commit/1b6c4f48aa74b1b193c25239c885d3b95bf173ac
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Forcefully center the window to prevent off-screen rendering

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 985965a730..29b3e00cb8 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -543,6 +543,10 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 	getWindowSizeFromSdl(&actualWidth, &actualHeight);
 
 	handleResize(actualWidth, actualHeight);
+
+	// WORKAROUND: Prevent (nearly) offscreen positioning of the ScummVM window by forcefully
+	// trigger a re-positioning event to center the window.
+	SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
 	return true;
 #else
 	// WORKAROUND: Working around infamous SDL bugs when switching


Commit: 4c7bc5effbbdcf4c05375536ffe04ea13e5a33bb
    https://github.com/scummvm/scummvm/commit/4c7bc5effbbdcf4c05375536ffe04ea13e5a33bb
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Do not try to center window in fullscreen or maximized mode

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 29b3e00cb8..024d422886 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -546,7 +546,9 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 
 	// WORKAROUND: Prevent (nearly) offscreen positioning of the ScummVM window by forcefully
 	// trigger a re-positioning event to center the window.
-	SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+	if (!_wantsFullScreen && !(SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_MAXIMIZED)) {
+		SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+	}
 	return true;
 #else
 	// WORKAROUND: Working around infamous SDL bugs when switching


Commit: 1b42675e52554b18501a3fe8184f9997b1cda32f
    https://github.com/scummvm/scummvm/commit/1b42675e52554b18501a3fe8184f9997b1cda32f
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Limit window positioning workaround to Win32

It looks like other platforms are not affected by this, at least I
wasn't able to reproduce the issue on Linux in any way.

Since branching off to the next release is very soon and we are running
out of time, I'm limiting this to Win32 in order to avoid unneccessary
breakage by only fixing _really_ affected platforms.

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 024d422886..12a62b4cc6 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -544,11 +544,13 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 
 	handleResize(actualWidth, actualHeight);
 
+#ifdef WIN32
 	// WORKAROUND: Prevent (nearly) offscreen positioning of the ScummVM window by forcefully
 	// trigger a re-positioning event to center the window.
 	if (!_wantsFullScreen && !(SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_MAXIMIZED)) {
 		SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
 	}
+#endif
 	return true;
 #else
 	// WORKAROUND: Working around infamous SDL bugs when switching


Commit: d6f105e906b14642d1eaada3e86b6f812dc197b1
    https://github.com/scummvm/scummvm/commit/d6f105e906b14642d1eaada3e86b6f812dc197b1
Author: Lothar Serra Mari (mail at serra.me)
Date: 2021-08-28T10:43:04+02:00

Commit Message:
BACKENDS: OPENGLSDL: Only relocate the window to the center of the screen if truly necessary

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 12a62b4cc6..1c3317a028 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -548,7 +548,16 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
 	// WORKAROUND: Prevent (nearly) offscreen positioning of the ScummVM window by forcefully
 	// trigger a re-positioning event to center the window.
 	if (!_wantsFullScreen && !(SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_MAXIMIZED)) {
-		SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+
+		// Read the current window position
+		int _xWindowPos;
+		SDL_GetWindowPosition(_window->getSDLWindow(), &_xWindowPos, NULL);
+
+		// Relocate the window to the center of the screen in case we try to draw
+		// outside the window area. In this case, _xWindowPos always returns 0.
+		if (_xWindowPos == 0) {
+			SDL_SetWindowPosition(_window->getSDLWindow(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+		}
 	}
 #endif
 	return true;




More information about the Scummvm-git-logs mailing list