From 22b350f9916947ead9c0db6d942ac5ba03ea4ca8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 9 Sep 2009 10:44:06 +0200 Subject: More robust implementation of qt_x11_wait_for_window_manager Make sure we recieve both ReparentNotify and MapNotify events. Also change the timeout to 2 seconds to cope with slow machines Reviewed-by: Denis --- src/gui/kernel/qwidget_x11.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 43a6bad..58fb3e8d 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -358,12 +358,17 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) if (!w->testAttribute(Qt::WA_WState_Created)) return; while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ReparentNotify, &ev)) { - if (XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), MapNotify, &ev)) - break; - if (t.elapsed() > 500) - return; // give up, no event available + if (t.elapsed() > 2000) + return; qApp->syncX(); // non-busy wait } + + while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), MapNotify, &ev)) { + if (t.elapsed() > 2000) + return; + qApp->syncX(); // non-busy wait + } + qApp->x11ProcessEvent(&ev); if (XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ConfigureNotify, &ev)) qApp->x11ProcessEvent(&ev); -- cgit v0.12