mirror of https://github.com/encounter/SDL.git
x11: check if the X server honored our XMoveWindow() call (thanks, R.E. Rust!).
This can happen if a window is still grabbed when we try to move it, or if the X11 ecosystem is just in a bad mood, I guess. This makes sure that SDL will report the correct position for a window; otherwise, SDL_GetWindowPosition will just report whatever the last SDL_SetWindowPosition call requested, even if the window didn't actually move. Fixes Bugzilla #4646.
This commit is contained in:
parent
a963e36e2d
commit
c0255be458
|
@ -805,9 +805,24 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
Display *display = data->videodata->display;
|
Display *display = data->videodata->display;
|
||||||
|
unsigned int childCount;
|
||||||
|
Window childReturn, root, parent;
|
||||||
|
Window* children;
|
||||||
|
XWindowAttributes attrs;
|
||||||
|
|
||||||
|
/*Attempt to move the window*/
|
||||||
X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
|
X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
|
||||||
X11_XFlush(display);
|
X11_XFlush(display);
|
||||||
|
|
||||||
|
/*If the window is not moved, then the coordinates on the window structure are out of sync, so we
|
||||||
|
update them here. */
|
||||||
|
X11_XQueryTree(display, data->xwindow, &root, &parent, &children, &childCount);
|
||||||
|
X11_XGetWindowAttributes(display, data->xwindow, &attrs);
|
||||||
|
X11_XTranslateCoordinates(display,
|
||||||
|
parent, DefaultRootWindow(display),
|
||||||
|
attrs.x, attrs.y,
|
||||||
|
&window->x, &window->y,
|
||||||
|
&childReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue