[Scummvm-git-logs] scummvm master -> 8c443f5fc9637fa303570d9e74a20e11ea96b0fe

lephilousophe noreply at scummvm.org
Sun Apr 26 15:41:28 UTC 2026


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

Summary:
994dc04a85 BACKENDS: OPENGLSDL: Don't store a size for the maximized state
8c443f5fc9 SDL: Make sure window flags are consistent between backends


Commit: 994dc04a8513f374e47dae37ab301966d8ce4e39
    https://github.com/scummvm/scummvm/commit/994dc04a8513f374e47dae37ab301966d8ce4e39
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-04-26T17:41:23+02:00

Commit Message:
BACKENDS: OPENGLSDL: Don't store a size for the maximized state

Fix #16666

When restoring from the maximized state while the maximized size was
used when creating the window, the window manager restores to something
sensible instead of using the last restored size we used.
As the maximized size has no real use, don't store and use it.

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/platform/sdl/sdl-window.cpp


diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 52d916e0c70..6e282afe9a9 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -440,8 +440,6 @@ void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) {
 		// Check if the ScummVM window is maximized and store the current
 		// window dimensions.
 		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);
@@ -478,15 +476,8 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
 	Common::Rect desktopRes = _window->getDesktopResolution();
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
-	bool isMaximized = ConfMan.getBool("window_maximized", 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 && ConfMan.hasKey("last_window_width", Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("last_window_height", Common::ConfigManager::kApplicationDomain)) {
+		if (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);
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index 4f44c492f3c..931fa8686b0 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -539,7 +539,11 @@ bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
 			SDL_SetWindowFullscreen(_window, fullscreenFlags);
 		} else {
 			SDL_SetWindowFullscreen(_window, fullscreenFlags);
-			SDL_SetWindowSize(_window, width, height);
+			if ((SDL_GetWindowFlags(_window) & SDL_WINDOW_MAXIMIZED) == 0) {
+				// Don't resize the window if we already are maximized
+				// This matches what SDL3 does
+				SDL_SetWindowSize(_window, width, height);
+			}
 			if (flags & SDL_WINDOW_MAXIMIZED) {
 				SDL_MaximizeWindow(_window);
 			} else {


Commit: 8c443f5fc9637fa303570d9e74a20e11ea96b0fe
    https://github.com/scummvm/scummvm/commit/8c443f5fc9637fa303570d9e74a20e11ea96b0fe
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-04-26T17:41:23+02:00

Commit Message:
SDL: Make sure window flags are consistent between backends

Changed paths:
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/platform/sdl/sdl-window.h


diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 60293d78471..ceb1fbdc387 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -71,7 +71,7 @@ static void getMouseState(int *x, int *y) {
 SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source, SdlWindow *window)
 	: _eventSource(source), _window(window), _hwScreen(nullptr)
 #if SDL_VERSION_ATLEAST(2, 0, 0)
-	, _allowWindowSizeReset(false), _hintedWidth(0), _hintedHeight(0), _lastFlags(0)
+	, _allowWindowSizeReset(false), _hintedWidth(0), _hintedHeight(0)
 #endif
 {
 	ConfMan.registerDefault("fullscreen_res", "desktop");
@@ -346,7 +346,7 @@ bool SdlGraphicsManager::createOrUpdateWindow(int width, int height, const Uint3
 	// size or pixel format of the internal game surface (since a user may have
 	// resized the game window), or when the launcher is visible (since a user
 	// may change the scaler, which should reset the window size)
-	if (!_window->getSDLWindow() || _lastFlags != flags || _overlayVisible || _allowWindowSizeReset) {
+	if (!_window->getSDLWindow() || _window->getWindowFlags() != flags || _overlayVisible || _allowWindowSizeReset) {
 #if SDL_VERSION_ATLEAST(3, 0, 0)
 		const bool fullscreen = (flags & (SDL_WINDOW_FULLSCREEN)) != 0;
 #else
@@ -374,7 +374,6 @@ bool SdlGraphicsManager::createOrUpdateWindow(int width, int height, const Uint3
 		}
 #endif
 
-		_lastFlags = flags;
 		_allowWindowSizeReset = false;
 	}
 
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 538483205b7..13795b94fab 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -202,7 +202,6 @@ public:
 	virtual void destroyingWindow() {}
 
 protected:
-	Uint32 _lastFlags;
 	bool _allowWindowSizeReset;
 	int _hintedWidth, _hintedHeight;
 
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 83d01772306..184fd87b33a 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2879,7 +2879,7 @@ void SurfaceSdlGraphicsManager::handleScalerHotkeys(uint mode, int factor) {
 	if (sizeChanged) {
 		// Forcibly resizing the window here since a user switching scaler
 		// size will not normally cause the window to update
-		_window->createOrUpdateWindow(_hwScreen->w, _hwScreen->h, _lastFlags);
+		_window->createOrUpdateWindow(_hwScreen->w, _hwScreen->h, _window->getWindowFlags());
 	}
 #endif
 
diff --git a/backends/platform/sdl/sdl-window.h b/backends/platform/sdl/sdl-window.h
index 87ff992a5ce..d3bceec8bcd 100644
--- a/backends/platform/sdl/sdl-window.h
+++ b/backends/platform/sdl/sdl-window.h
@@ -185,6 +185,11 @@ public:
 	 */
 	void destroyWindow();
 
+	/**
+	 * @return The last window flags set
+	 */
+	uint32 getWindowFlags() const { return _lastFlags; }
+
 protected:
 	SDL_Window *_window;
 




More information about the Scummvm-git-logs mailing list