Skip to content

Commit 210b317

Browse files
committed
x11: Popup positions after constraining are in the window-relative space, not global
1 parent daa7a5a commit 210b317

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/video/x11/SDL_x11window.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,17 +1516,13 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
15161516
SDL_WindowData *data = window->internal;
15171517
Display *display = data->videodata->display;
15181518
bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, true);
1519-
bool position_is_absolute = false;
15201519
bool set_position = false;
15211520
XEvent event;
15221521

15231522
if (SDL_WINDOW_IS_POPUP(window)) {
15241523
// Update the position in case the parent moved while we were hidden
15251524
X11_ConstrainPopup(window, true);
15261525
data->pending_position = true;
1527-
1528-
// Coordinates after X11_ConstrainPopup() are already in the global space.
1529-
position_is_absolute = true;
15301526
set_position = true;
15311527
}
15321528

@@ -1569,14 +1565,11 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
15691565
const int tx = data->pending_position ? window->pending.x : window->x;
15701566
const int ty = data->pending_position ? window->pending.y : window->y;
15711567
int x, y;
1572-
if (position_is_absolute) {
1573-
x = tx;
1574-
y = ty;
1575-
} else {
1576-
SDL_RelativeToGlobalForWindow(window,
1577-
tx - data->border_left, ty - data->border_top,
1578-
&x, &y);
1579-
}
1568+
1569+
SDL_RelativeToGlobalForWindow(window,
1570+
tx - data->border_left, ty - data->border_top,
1571+
&x, &y);
1572+
15801573
data->pending_position = false;
15811574
X11_XMoveWindow(display, data->xwindow, x, y);
15821575
}

0 commit comments

Comments
 (0)