summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-09-12 14:36:57 +0200
committerGitHub <noreply@github.com>2018-09-12 14:36:57 +0200
commit143f522adbc88eabf2cfa9c70d007221fa542f0d (patch)
treed8957fb325fbb532c2d709e310b0b4cf2514018f
parentf98d946cd9cd14f3635dd9cd80be79ca9850d477 (diff)
parent9a1deedb8406bc25d6c1a8e414cb34cc3321a07a (diff)
Merge pull request #21914 from hpvb/fix-21720
When resizing an X11 window wait for the WM to process our request
-rw-r--r--platform/x11/os_x11.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 4fd1a0c767..20c9dd6290 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1082,6 +1082,16 @@ Size2 OS_X11::get_real_window_size() const {
}
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 (is_window_resizable() == false) {
XSizeHints *xsh;
@@ -1101,6 +1111,16 @@ void OS_X11::set_window_size(const Size2 p_size) {
// Update our videomode width and height
current_videomode.width = p_size.x;
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) {