summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandwlshellintegration.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@theqtcompany.com>2016-03-19 15:36:22 +0100
committerJohan Helsing <johan.helsing@qt.io>2016-09-20 08:15:55 +0000
commitb248defd1741cd443dd1e5050fe5143e8650a7c7 (patch)
tree1dc2b7a552ba2051cbf549b510fe6d0b6a5a3979 /src/compositor/extensions/qwaylandwlshellintegration.cpp
parentc7e417e8d552f3a6a10ac12f96119d083f081fc0 (diff)
Compositor API: Add closeAllPopups method to QWaylandWlShell
The WlShell implementation now matches xdg shell. Also adds a convenience method to QWaylandWlShell to get all popups. QWaylandWlShellIntegration and qwindow-compositor uses this new API. Change-Id: Ibfe3323ad7f56d43379785582b9be6801905a485 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>
Diffstat (limited to 'src/compositor/extensions/qwaylandwlshellintegration.cpp')
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index 1acc01dd7..ba2fe5fb4 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -56,6 +56,7 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item)
connect(m_shellSurface, &QWaylandWlShellSurface::startMove, this, &WlShellIntegration::handleStartMove);
connect(m_shellSurface, &QWaylandWlShellSurface::startResize, this, &WlShellIntegration::handleStartResize);
connect(m_shellSurface->surface(), &QWaylandSurface::offsetForNextFrame, this, &WlShellIntegration::adjustOffsetForNextFrame);
+ connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged, this, &WlShellIntegration::handleSurfaceHasContentChanged);
connect(m_shellSurface, &QWaylandWlShellSurface::setPopup, this, &WlShellIntegration::handleSetPopup);
connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed);
}
@@ -107,13 +108,12 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par
}
isPopup = true;
- QWaylandQuickShellEventFilter::startFilter(m_shellSurface->surface()->client(), &closePopups);
+ QWaylandQuickShellEventFilter::startFilter(m_shellSurface->surface()->client(), [&]() {
+ m_shellSurface->shell()->closeAllPopups();
+ });
- if (!popupShellSurfaces.contains(m_shellSurface)) {
- popupShellSurfaces.append(m_shellSurface);
- QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
- this, &WlShellIntegration::handleSurfaceHasContentChanged);
- }
+ QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
void WlShellIntegration::handlePopupClosed()
@@ -126,9 +126,7 @@ void WlShellIntegration::handlePopupClosed()
void WlShellIntegration::handlePopupRemoved()
{
- if (m_shellSurface)
- popupShellSurfaces.removeOne(m_shellSurface);
- if (popupShellSurfaces.isEmpty())
+ if (m_shellSurface->shell()->mappedPopups().isEmpty())
QWaylandQuickShellEventFilter::cancelFilter();
isPopup = false;
}
@@ -143,9 +141,10 @@ void WlShellIntegration::handleShellSurfaceDestroyed()
void WlShellIntegration::handleSurfaceHasContentChanged()
{
- if (!m_shellSurface || !m_shellSurface->surface()->size().isEmpty())
- return;
- handlePopupClosed();
+ if (m_shellSurface && m_shellSurface->surface()->size().isEmpty()
+ && m_shellSurface->windowType() == Qt::WindowType::Popup) {
+ handlePopupClosed();
+ }
}
void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset)
@@ -194,18 +193,6 @@ bool WlShellIntegration::mouseReleaseEvent(QMouseEvent *event)
return false;
}
-QVector<QWaylandWlShellSurface*> WlShellIntegration::popupShellSurfaces;
-
-void WlShellIntegration::closePopups()
-{
- if (!popupShellSurfaces.isEmpty()) {
- Q_FOREACH (QWaylandWlShellSurface* shellSurface, popupShellSurfaces) {
- shellSurface->sendPopupDone();
- }
- popupShellSurfaces.clear();
- }
-}
-
}
QT_END_NAMESPACE