SDL: Don't resize fullscreen windows when hiding or minimizing them (thanks @madewokherd!)

From 268c2fa882559dd4e0fa09cad91e4a286e73654f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 5 Apr 2022 18:42:17 -0700
Subject: [PATCH] Don't resize fullscreen windows when hiding or minimizing
 them (thanks @madewokherd!)

This has the benefit of window previews (mousing over the icon) having the correct size and contents.

Fixes https://github.com/libsdl-org/SDL/issues/5320
---
 src/video/windows/SDL_windowswindow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 890d790eab0..90566d88437 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -734,6 +734,13 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
     int x, y;
     int w, h;
 
+    if (!fullscreen && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) {
+        /* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary.
+         * Also, Windows would preview the minimized window with the wrong size.
+         */
+        return;
+    }
+
     if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) {
         top = HWND_TOPMOST;
     } else {