SDL: video: Send pending coordinates for moved, hidden windows (6f1af)

From 6f1afe70842fe4fc311b370bd02e4849103f0fd7 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sun, 16 Mar 2025 11:00:40 -0400
Subject: [PATCH] video: Send pending coordinates for moved, hidden windows

Some backends can't actually position a window until it is shown/mapped, so assume that it will be where it was asked to be as long as it is hidden.

(cherry picked from commit d66483dfccfcdc4e03f719e318c7a76f963f22d9)
---
 src/video/SDL_video.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 3ed49941e46a9..ebad40d8b181b 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -2924,11 +2924,12 @@ bool SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
             }
         }
     } else {
+        const bool use_current = !(window->flags & SDL_WINDOW_HIDDEN) && !window->last_position_pending;
         if (x) {
-            *x = window->x;
+            *x = use_current ? window->x : window->pending.x;
         }
         if (y) {
-            *y = window->y;
+            *y = use_current ? window->y : window->pending.y;
         }
     }
     return true;