SDL-1.2: atari:video:gem: fix restoring a maximised window

From 81490298a02fe6806c05ac7b5afde7d88fcc7bf9 Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Thu, 15 Oct 2026 09:27:18 +1000
Subject: [PATCH] atari:video:gem: fix restoring a maximised window

Resizing the window to its current size overwrote the previous window
position stored by the AES, so the fuller button did not restore the
original size.
---
 src/video/gem/SDL_gemvideo.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/video/gem/SDL_gemvideo.c b/src/video/gem/SDL_gemvideo.c
index 0b7f647a..f31363cd 100644
--- a/src/video/gem/SDL_gemvideo.c
+++ b/src/video/gem/SDL_gemvideo.c
@@ -843,10 +843,12 @@ static SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
 		} else {
 			/* Resize window to fit asked video mode */
 			wind_get_grect (GEM_handle, WF_WORKXYWH, &gr);
-			gr.g_w = width;
-			gr.g_h = height;
-			if (wind_calc_grect(WC_BORDER, GEM_win_type, &gr, &gr)) {
-				wind_set_grect (GEM_handle, WF_CURRXYWH, &gr);
+			if ((gr.g_w != width) || (gr.g_h != height)) {
+				gr.g_w = width;
+				gr.g_h = height;
+				if (wind_calc_grect(WC_BORDER, GEM_win_type, &gr, &gr)) {
+					wind_set_grect (GEM_handle, WF_CURRXYWH, &gr);
+				}
 			}
 		}