SDL: x11: Assume the window was mapped after showing (25bd4)

From 25bd4285aba4a1c085663eb1e54a7c41a84ea772 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 23 May 2025 11:44:36 -0400
Subject: [PATCH] x11: Assume the window was mapped after showing

Not all window managers send a MapNotify or PropertyNotify event when the window is shown, so assume that it was mapped and set the flag accordingly.

(cherry picked from commit b70919ecd9696198755c2fa326c54f52dc9f355b)
---
 src/video/x11/SDL_x11window.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 7e15433499989..3a6b4ae78da46 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -1574,6 +1574,12 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
     X11_PumpEvents(_this);
     data->size_move_event_flags = 0;
 
+    /* A MapNotify or PropertyNotify may not have arrived, so ensure that the shown event is dispatched
+     * to apply pending state before clearing the flag.
+     */
+    SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
+    data->was_shown = true;
+
     // If a configure event was received (type is non-zero), send the final window size and coordinates.
     if (data->last_xconfigure.type) {
         int x, y;