From 16df5ed7f8d44fda67b58a1feee2f9b62e30d525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 19 Dec 2016 11:43:09 +0200 Subject: [PATCH] tcuX11: fix to wait for matching ConfigureNotify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch changes loop in setDimensions to spin until exact matching ConfigureNotify event was caught. This makes sure that we don't catch something that was in the event queue earlier and conclude that as event triggered by our resize. Signed-off-by: Tapani Pälli --- framework/platform/X11/tcuX11.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/framework/platform/X11/tcuX11.cpp b/framework/platform/X11/tcuX11.cpp index ee24d13..6f66364 100644 --- a/framework/platform/X11/tcuX11.cpp +++ b/framework/platform/X11/tcuX11.cpp @@ -232,20 +232,21 @@ void XlibWindow::getDimensions (int* width, int* height) const void XlibWindow::setDimensions (int width, int height) { - const unsigned int mask = CWWidth | CWHeight; - XWindowChanges changes; ::Display* dpy = m_display.getXDisplay(); XEvent myevent; - changes.width = width; - changes.height = height; - XConfigureWindow(dpy, m_window, mask, &changes); + + XResizeWindow(dpy, m_window, width, height); XFlush(dpy); + // Spin until we got the ConfigureNotify matching the size set for(;;) { XNextEvent(dpy, &myevent); - if (myevent.type == ConfigureNotify) - break; + if (myevent.type == ConfigureNotify) { + XConfigureEvent e = myevent.xconfigure; + if (e.width == width && e.height == height) + break; + } } } -- 2.7.4