summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp30
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h3
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h5
3 files changed, 38 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)
*
diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h
index 12c5e1ca2..13dae2e36 100644
--- a/src/compositor/extensions/qwaylandwlshell.h
+++ b/src/compositor/extensions/qwaylandwlshell.h
@@ -63,6 +63,8 @@ public:
QWaylandWlShell(QWaylandCompositor *compositor);
void initialize() Q_DECL_OVERRIDE;
+ QList<QWaylandWlShellSurface *> shellSurfaces() const;
+ QList<QWaylandWlShellSurface *> shellSurfacesForClient(QWaylandClient* client) const;
static const struct wl_interface *interface();
static QByteArray interfaceName();
@@ -112,6 +114,7 @@ public:
QWaylandWlShellSurface();
QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
+ virtual ~QWaylandWlShellSurface();
Q_INVOKABLE void initialize(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h
index 39ed645c1..8888e2eb5 100644
--- a/src/compositor/extensions/qwaylandwlshell_p.h
+++ b/src/compositor/extensions/qwaylandwlshell_p.h
@@ -70,10 +70,15 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellPrivate
Q_DECLARE_PUBLIC(QWaylandWlShell)
public:
QWaylandWlShellPrivate();
+
+ void unregisterShellSurface(QWaylandWlShellSurface *shellSurface);
+
static QWaylandWlShellPrivate *get(QWaylandWlShell *shell) { return shell->d_func(); }
protected:
void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
+
+ QList<QWaylandWlShellSurface *> m_shellSurfaces;
};
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate