|
|
@@ -1535,6 +1535,11 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
bool set_position = false;
|
|
|
XEvent event;
|
|
|
|
|
|
+ // If the window was previously shown, pump events to avoid possible positioning issues.
|
|
|
+ if (data->was_shown) {
|
|
|
+ X11_PumpEvents(_this);
|
|
|
+ }
|
|
|
+
|
|
|
if (SDL_WINDOW_IS_POPUP(window)) {
|
|
|
// Update the position in case the parent moved while we were hidden
|
|
|
X11_ConstrainPopup(window, true);
|
|
|
@@ -1577,14 +1582,12 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
}
|
|
|
|
|
|
if (set_position) {
|
|
|
- // Apply the window position, accounting for offsets due to the borders appearing.
|
|
|
- const int tx = data->pending_position ? window->pending.x : window->x;
|
|
|
- const int ty = data->pending_position ? window->pending.y : window->y;
|
|
|
+ // Apply the window position, accounting for offsets due to the borders appearing, but only when initially mapping.
|
|
|
+ const int tx = (data->pending_position ? window->pending.x : window->x) - (data->was_shown ? 0 : data->border_left);
|
|
|
+ const int ty = (data->pending_position ? window->pending.y : window->y) - (data->was_shown ? 0 : data->border_top);
|
|
|
int x, y;
|
|
|
|
|
|
- SDL_RelativeToGlobalForWindow(window,
|
|
|
- tx - data->border_left, ty - data->border_top,
|
|
|
- &x, &y);
|
|
|
+ SDL_RelativeToGlobalForWindow(window, tx, ty, &x, &y);
|
|
|
|
|
|
data->pending_position = false;
|
|
|
X11_XMoveWindow(display, data->xwindow, x, y);
|