From d66483dfccfcdc4e03f719e318c7a76f963f22d9 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.
---
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 a940cb8c7c002..1540e92b83eb1 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -2925,11 +2925,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;