summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-08-17 10:02:16 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-08-17 14:39:46 +0000
commit53d7bffef7fd7f2e1026ac54e5c8bdb3df761208 (patch)
tree14b5494ee9838ab78186d49735e7411eaf6e01e2
parent4d2106d4b6ed1a088834a8fec9c6a47e5a67d4e8 (diff)
Compositor: Add QWaylandXdgToplevel::fromResource
Change-Id: I0f388a4c4f6b765c34d115a6583982d86bc82557 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.cpp13
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h1
2 files changed, 9 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp
index 4f468b0ae..01543135a 100644
--- a/src/compositor/extensions/qwaylandxdgshell.cpp
+++ b/src/compositor/extensions/qwaylandxdgshell.cpp
@@ -1111,6 +1111,13 @@ QWaylandSurfaceRole *QWaylandXdgToplevel::role()
return &QWaylandXdgToplevelPrivate::s_role;
}
+/*!
+ * Returns the QWaylandXdgToplevel corresponding to the \a resource.
+ */
+QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)
+{
+ return static_cast<QWaylandXdgToplevelPrivate *>(QWaylandXdgToplevelPrivate::Resource::fromResource(resource)->xdg_toplevel_object)->q_func();
+}
/*!
* \qmlsignal QtWaylandCompositor::XdgShell::xdgSurfaceCreated(XdgSurface xdgSurface)
@@ -1290,11 +1297,7 @@ void QWaylandXdgToplevelPrivate::xdg_toplevel_destroy(QtWaylandServer::xdg_tople
void QWaylandXdgToplevelPrivate::xdg_toplevel_set_parent(QtWaylandServer::xdg_toplevel::Resource *resource, wl_resource *parent)
{
Q_UNUSED(resource);
- QWaylandXdgToplevel *parentToplevel = nullptr;
- if (parent) {
- parentToplevel = static_cast<QWaylandXdgToplevelPrivate *>(
- QWaylandXdgToplevelPrivate::Resource::fromResource(parent)->xdg_toplevel_object)->q_func();
- }
+ QWaylandXdgToplevel *parentToplevel = QWaylandXdgToplevel::fromResource(parent);
Q_Q(QWaylandXdgToplevel);
diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h
index 6f660eb1f..5467290f6 100644
--- a/src/compositor/extensions/qwaylandxdgshell.h
+++ b/src/compositor/extensions/qwaylandxdgshell.h
@@ -183,6 +183,7 @@ public:
Q_INVOKABLE uint sendResizing(const QSize &maxSize);
static QWaylandSurfaceRole *role();
+ static QWaylandXdgToplevel *fromResource(::wl_resource *resource);
Q_SIGNALS:
void parentToplevelChanged();