[Scummvm-git-logs] scummvm master -> 594a81f93cb86c9c0ebb5b80f4ad94f4d3809656

bluegr bluegr at gmail.com
Sun Oct 10 23:59:04 UTC 2021


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:
45a803c71c OPENGLSDL: Fix always restoring window to maximized size when exiting fullscreen
594a81f93c OPENGLSDL: Fix restoring window size when exiting fullscreen


Commit: 45a803c71c8563d36d7f71b711d8e244c25c7c57
    https://github.com/scummvm/scummvm/commit/45a803c71c8563d36d7f71b711d8e244c25c7c57
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-10-11T02:59:01+03:00

Commit Message:
OPENGLSDL: Fix always restoring window to maximized size when exiting fullscreen

When loadVideoMode gets called to exit fullscreen, the window is
still fullscreen, which means that the SDL_WINDOW_MAXIMIZED is set
(at least on macOS). As a result the window was resized to the
stored maximized window size instead of the size it had before
entering fullscreen.

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 1d520d518c..ca2cc80095 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -348,8 +348,7 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
 	Common::Rect desktopRes = _window->getDesktopResolution();
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
-	SDL_Window *window = _window->getSDLWindow();
-	bool isMaximized = window ? (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) : false;
+	bool isMaximized = ConfMan.getBool("window_maximized", 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.


Commit: 594a81f93cb86c9c0ebb5b80f4ad94f4d3809656
    https://github.com/scummvm/scummvm/commit/594a81f93cb86c9c0ebb5b80f4ad94f4d3809656
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-10-11T02:59:01+03:00

Commit Message:
OPENGLSDL: Fix restoring window size when exiting fullscreen

When entering fullscreen it was storing the default window size
in the config, which was overwriting the current window size. As
a result when exiting window size, instead of restoring to the
previous window size it was restoring to the default window size.

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 ca2cc80095..870686083e 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -349,27 +349,29 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	bool isMaximized = ConfMan.getBool("window_maximized", 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);
+	if (!_wantsFullScreen) {
+		if (isMaximized && 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 && !_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);
+		} else if (!isMaximized && 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);
 
-	} else {
-		// Set the basic window size based on the desktop resolution
-		// since we have no values stored, e.g. on first launch.
-		requestedWidth  = MAX<uint>(desktopRes.width() / 2, 640);
-		requestedHeight = requestedWidth * 3 / 4;
-
-		// Save current window dimensions
-		ConfMan.setInt("last_window_width", requestedWidth, Common::ConfigManager::kApplicationDomain);
-		ConfMan.setInt("last_window_height", requestedHeight, Common::ConfigManager::kApplicationDomain);
-		ConfMan.flushToDisk();
+		} else {
+			// Set the basic window size based on the desktop resolution
+			// since we have no values stored, e.g. on first launch.
+			requestedWidth  = MAX<uint>(desktopRes.width() / 2, 640);
+			requestedHeight = requestedWidth * 3 / 4;
+
+			// Save current window dimensions
+			ConfMan.setInt("last_window_width", requestedWidth, Common::ConfigManager::kApplicationDomain);
+			ConfMan.setInt("last_window_height", requestedHeight, Common::ConfigManager::kApplicationDomain);
+			ConfMan.flushToDisk();
+		}
 	}
 
 #else




More information about the Scummvm-git-logs mailing list