summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2017-07-21 10:21:22 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2017-09-07 09:50:36 +0000
commit3f400e31fecd1c0436ad17d1be1dae7745c6a4f5 (patch)
treec72c88b906dfb0885620559850422fa7e65f44bb /src/client/qwaylandwindow.cpp
parentbde5619e2090efdc16823de21ff5cb76805204bd (diff)
Close popups in the correct order
According to the protocol, child popups have to be closed before parents, but QMenuBar/QMenu will sometimes close the parent first. Change-Id: Id027ac483b727a19388df619fe1503d794e12c12 Task-number: QTBUG-62048 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index eeba6c85..6649493b 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -341,9 +341,26 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect)
QWindowSystemInterface::handleExposeEvent(window(), rect);
}
+
+static QVector<QPointer<QWaylandWindow>> activePopups;
+
+void QWaylandWindow::closePopups(QWaylandWindow *parent)
+{
+ while (!activePopups.isEmpty()) {
+ auto popup = activePopups.takeLast();
+ if (popup.isNull())
+ continue;
+ if (popup.data() == parent)
+ return;
+ popup->reset();
+ }
+}
+
void QWaylandWindow::setVisible(bool visible)
{
if (visible) {
+ if (window()->type() == Qt::Popup)
+ activePopups << this;
initWindow();
mDisplay->flushRequests();
@@ -357,6 +374,8 @@ void QWaylandWindow::setVisible(bool visible)
// case 'this' will be deleted. When that happens, we must abort right away.
QPointer<QWaylandWindow> deleteGuard(this);
QWindowSystemInterface::flushWindowSystemEvents();
+ if (!deleteGuard.isNull() && window()->type() == Qt::Popup)
+ closePopups(this);
if (!deleteGuard.isNull())
reset();
}