SDL: x11: Specify windowed dimensions when creating fullscreen windows.

From 4ca7b378c5b831a82f1f0fa132939e8a3b6ac59a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 21 Aug 2022 11:35:14 -0400
Subject: [PATCH] x11: Specify windowed dimensions when creating fullscreen
 windows.

This lets the window manager adjust the window correctly if it ever
leaves fullscreen mode.

Fixes #5725.
---
 src/video/x11/SDL_x11window.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index e8fee1c1217..bfba775f200 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -526,8 +526,14 @@ X11_CreateWindow(_THIS, SDL_Window * window)
                             visual, AllocNone);
     }
 
+    /* Always create this with the window->windowed.* fields; if we're
+       creating a windowed mode window, that's fine. If we're creating a
+       fullscreen window, the window manager will want to know these values
+       so it can use them if we go _back_ to windowed mode. SDL manages
+       migration to fullscreen after CreateSDLWindow returns, which will
+       put all the SDL_Window fields and system state as expected. */
     w = X11_XCreateWindow(display, RootWindow(display, screen),
-                      window->x, window->y, window->w, window->h,
+                      window->windowed.x, window->windowed.y, window->windowed.w, window->windowed.h,
                       0, depth, InputOutput, visual,
                       (CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
                        CWBackingStore | CWColormap), &xattr);