mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
x11: Wait a bit in SDL_SetWindowSize() to see if window manager vetoed change.
Same idea as the fix for Bugzilla #4646. Fixes Bugzilla #4727.
This commit is contained in:
parent
e731522578
commit
1b82606e1d
@ -910,6 +910,14 @@ X11_SetWindowSize(_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;
|
||||||
|
XWindowAttributes attrs;
|
||||||
|
int orig_w, orig_h;
|
||||||
|
Uint32 timeout;
|
||||||
|
|
||||||
|
X11_XSync(display, False);
|
||||||
|
X11_XGetWindowAttributes(display, data->xwindow, &attrs);
|
||||||
|
orig_w = attrs.width;
|
||||||
|
orig_h = attrs.height;
|
||||||
|
|
||||||
if (SDL_IsShapedWindow(window)) {
|
if (SDL_IsShapedWindow(window)) {
|
||||||
X11_ResizeWindowShape(window);
|
X11_ResizeWindowShape(window);
|
||||||
@ -953,7 +961,27 @@ X11_SetWindowSize(_THIS, SDL_Window * window)
|
|||||||
X11_XResizeWindow(display, data->xwindow, window->w, window->h);
|
X11_XResizeWindow(display, data->xwindow, window->w, window->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
X11_XFlush(display);
|
/* Wait a brief time to see if the window manager decided to let this resize happen.
|
||||||
|
If the window changes at all, even to an unexpected value, we break out. */
|
||||||
|
timeout = SDL_GetTicks() + 100;
|
||||||
|
while (SDL_TRUE) {
|
||||||
|
X11_XSync(display, False);
|
||||||
|
X11_XGetWindowAttributes(display, data->xwindow, &attrs);
|
||||||
|
|
||||||
|
if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
|
||||||
|
window->w = attrs.width;
|
||||||
|
window->h = attrs.height;
|
||||||
|
break; /* window changed, time to go. */
|
||||||
|
} else if ((attrs.width == window->w) && (attrs.height == window->h)) {
|
||||||
|
break; /* we're at the place we wanted to be anyhow, drop out. */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Delay(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user