mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
x11: Popup positions after constraining are in the window-relative space, not global
(cherry picked from commit 210b317d8d
)
This commit is contained in:

committed by
Sam Lantinga

parent
5c224a3221
commit
519011f271
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user