summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-08-27 07:27:13 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-09-07 08:08:05 (GMT)
commit854a274d7b17277235acc1fb3c36f576c7c6b8ec (patch)
treeb6322ebb1cd4208d163e7c40105b5ec357d183a4 /src/gui
parentfb32c57686f3ed88671098f4ee8417bd2a325352 (diff)
downloadQt-854a274d7b17277235acc1fb3c36f576c7c6b8ec.zip
Qt-854a274d7b17277235acc1fb3c36f576c7c6b8ec.tar.gz
Qt-854a274d7b17277235acc1fb3c36f576c7c6b8ec.tar.bz2
Fixed hiding a window on X11 before it was shown.
On X11 show() just issues a request to show a window, so if someone tries to call hide() before the window was successfully mapped to the screen by the window manager it will not work (on most window managers unfortunately). So instead, when hide() is called we internally mark the window as "no need to show anymore" and then if we still get MapNotify event, we will hide the window right away. Reviewed-by: Markus Goetz Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_x11.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index e4d9848..7495f6d 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3642,6 +3642,11 @@ int QApplication::x11ProcessEvent(XEvent* event)
case MapNotify: // window shown
if (widget->isWindow()) {
+ // if we got a MapNotify when we were not waiting for it, it most
+ // likely means the user has already asked to hide the window before
+ // it ever being shown, so we try to withdraw a window after sending
+ // the QShowEvent.
+ bool pendingHide = widget->testAttribute(Qt::WA_WState_ExplicitShowHide) && widget->testAttribute(Qt::WA_WState_Hidden);
widget->d_func()->topData()->waitingForMapNotify = 0;
if (widget->windowType() != Qt::Popup) {
@@ -3661,6 +3666,8 @@ int QApplication::x11ProcessEvent(XEvent* event)
widget->setAttribute(Qt::WA_WState_Visible, true);
}
}
+ if (pendingHide) // hide the window
+ XWithdrawWindow(X11->display, widget->internalWinId(), widget->x11Info().screen());
}
break;