x11: Popup positions after constraining are in the window-relative space, not global

This commit is contained in:
Frank Praznik
2025-03-29 13:53:52 -04:00
parent daa7a5ad7e
commit 210b317d8d

View File

@@ -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);
}