From 210b317d8dc638407505390a032a11c54b48d789 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 29 Mar 2025 13:53:52 -0400
Subject: [PATCH] x11: Popup positions after constraining are in the
window-relative space, not global
---
src/video/x11/SDL_x11window.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 5ad27d854b6e1..20a85321e959c 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -1516,7 +1516,6 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_WindowData *data = window->internal;
Display *display = data->videodata->display;
bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, true);
- bool position_is_absolute = false;
bool set_position = false;
XEvent event;
@@ -1524,9 +1523,6 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
// Update the position in case the parent moved while we were hidden
X11_ConstrainPopup(window, true);
data->pending_position = true;
-
- // Coordinates after X11_ConstrainPopup() are already in the global space.
- position_is_absolute = true;
set_position = true;
}
@@ -1569,14 +1565,11 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
const int tx = data->pending_position ? window->pending.x : window->x;
const int ty = data->pending_position ? window->pending.y : window->y;
int x, y;
- if (position_is_absolute) {
- x = tx;
- y = ty;
- } else {
- SDL_RelativeToGlobalForWindow(window,
- tx - data->border_left, ty - data->border_top,
- &x, &y);
- }
+
+ SDL_RelativeToGlobalForWindow(window,
+ tx - data->border_left, ty - data->border_top,
+ &x, &y);
+
data->pending_position = false;
X11_XMoveWindow(display, data->xwindow, x, y);
}