From 519011f271d85bea73bcf2353f89bb715ebee549 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 29 Mar 2025 13:53:52 -0400 Subject: [PATCH] x11: Popup positions after constraining are in the window-relative space, not global (cherry picked from commit 210b317d8dc638407505390a032a11c54b48d789) --- 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 1ac7db34a7..e96a5acacc 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1438,7 +1438,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; @@ -1446,9 +1445,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; } @@ -1491,14 +1487,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); }