sdl2-compat: Always use hide+create+show flow to minimize variation and narrow down bug reports

From 5e1c0e3e8eab96e6df5c11fce3070c8ea49096e6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 6 Mar 2023 11:43:47 -0800
Subject: [PATCH] Always use hide+create+show flow to minimize variation and
 narrow down bug reports

---
 src/sdl2_compat.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 973d036..4307c2d 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -4409,21 +4409,20 @@ DECLSPEC SDL_Window * SDLCALL
 SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
 {
     SDL_Window *window;
-    int setpos = (x != SDL_WINDOWPOS_UNDEFINED || y != SDL_WINDOWPOS_UNDEFINED);
     int hidden = flags & SDL_WINDOW_HIDDEN;
 
     flags &= ~SDL2_WINDOW_SHOWN;
-    if (setpos) {
-        flags |= SDL_WINDOW_HIDDEN;
-    }
+    flags |= SDL_WINDOW_HIDDEN;
     if (flags & SDL2_WINDOW_FULLSCREEN_DESKTOP) {
         flags &= ~SDL2_WINDOW_FULLSCREEN_DESKTOP;
-        flags |= SDL_WINDOW_FULLSCREEN; /* FIXME  force fullscreen desktop ? */
+        flags |= SDL_WINDOW_FULLSCREEN; /* This is fullscreen desktop for new windows */
     }
 
     window = SDL3_CreateWindow(title, w, h, flags);
-    if (window && setpos) {
-        SDL3_SetWindowPosition(window, x, y);
+    if (window) {
+        if (!SDL_WINDOWPOS_ISUNDEFINED(x) || !SDL_WINDOWPOS_ISUNDEFINED(y)) {
+            SDL3_SetWindowPosition(window, x, y);
+        }
         if (!hidden) {
             SDL3_ShowWindow(window);
         }