Merge pull request #21914 from hpvb/fix-21720
When resizing an X11 window wait for the WM to process our request
This commit is contained in:
commit
143f522adb
1 changed files with 20 additions and 0 deletions
|
@ -1082,6 +1082,16 @@ Size2 OS_X11::get_real_window_size() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_X11::set_window_size(const Size2 p_size) {
|
void OS_X11::set_window_size(const Size2 p_size) {
|
||||||
|
|
||||||
|
if (current_videomode.width == p_size.width && current_videomode.height == p_size.height)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XWindowAttributes xwa;
|
||||||
|
XSync(x11_display, False);
|
||||||
|
XGetWindowAttributes(x11_display, x11_window, &xwa);
|
||||||
|
int old_w = xwa.width;
|
||||||
|
int old_h = xwa.height;
|
||||||
|
|
||||||
// If window resizable is disabled we need to update the attributes first
|
// If window resizable is disabled we need to update the attributes first
|
||||||
if (is_window_resizable() == false) {
|
if (is_window_resizable() == false) {
|
||||||
XSizeHints *xsh;
|
XSizeHints *xsh;
|
||||||
|
@ -1101,6 +1111,16 @@ void OS_X11::set_window_size(const Size2 p_size) {
|
||||||
// Update our videomode width and height
|
// Update our videomode width and height
|
||||||
current_videomode.width = p_size.x;
|
current_videomode.width = p_size.x;
|
||||||
current_videomode.height = p_size.y;
|
current_videomode.height = p_size.y;
|
||||||
|
|
||||||
|
for (int timeout = 0; timeout < 50; ++timeout) {
|
||||||
|
XSync(x11_display, False);
|
||||||
|
XGetWindowAttributes(x11_display, x11_window, &xwa);
|
||||||
|
|
||||||
|
if (old_w != xwa.width || old_h != xwa.height)
|
||||||
|
break;
|
||||||
|
|
||||||
|
usleep(10000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_X11::set_window_fullscreen(bool p_enabled) {
|
void OS_X11::set_window_fullscreen(bool p_enabled) {
|
||||||
|
|
Loading…
Reference in a new issue