summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandwlshell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/extensions/qwaylandwlshell.cpp')
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index 90f591956..51c73fc64 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -86,9 +86,16 @@ void QWaylandWlShellPrivate::shell_get_shell_surface(Resource *resource, uint32_
shellSurface = new QWaylandWlShellSurface(q, surface, shellSurfaceResource);
}
+ m_shellSurfaces.append(shellSurface);
emit q->shellSurfaceCreated(shellSurface);
}
+void QWaylandWlShellPrivate::unregisterShellSurface(QWaylandWlShellSurface *shellSurface)
+{
+ if (!m_shellSurfaces.removeOne(shellSurface))
+ qWarning("Unexpected state. Can't find registered shell surface.");
+}
+
QWaylandWlShellSurfacePrivate::QWaylandWlShellSurfacePrivate()
: QWaylandCompositorExtensionPrivate()
, wl_shell_surface()
@@ -308,6 +315,23 @@ void QWaylandWlShell::initialize()
d->init(compositor->display(), 1);
}
+QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfaces() const
+{
+ Q_D(const QWaylandWlShell);
+ return d->m_shellSurfaces;
+}
+
+QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfacesForClient(QWaylandClient *client) const
+{
+ Q_D(const QWaylandWlShell);
+ QList<QWaylandWlShellSurface *> surfsForClient;
+ Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) {
+ if (shellSurface->surface()->client() == client)
+ surfsForClient.append(shellSurface);
+ }
+ return surfsForClient;
+}
+
/*!
* Returns the Wayland interface for the QWaylandWlShell.
*/
@@ -385,6 +409,12 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandS
initialize(shell, surface, res);
}
+QWaylandWlShellSurface::~QWaylandWlShellSurface()
+{
+ Q_D(QWaylandWlShellSurface);
+ QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
+}
+
/*!
* \qmlmethod void QtWaylandCompositor::WlShellSurface::initialize(object shell, object surface, object client, int id)
*