diff options
author | Giulio Camuffo <giulio.camuffo@kdab.com> | 2016-03-24 12:53:07 +0200 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@kdab.com> | 2016-03-29 12:11:07 +0000 |
commit | 8b89cef7d50325d576fc1206fda840a05b0578fb (patch) | |
tree | 74358e0f2971d5ae8e79f150a6fbac813887468a /src/compositor/extensions/qwaylandshell.cpp | |
parent | f3913dddee41b4a2c52518e720ac1945fde3bbab (diff) |
Add QWaylandShellSurface::fromResource()
Also make sure that the generated *::Resource::fromResource() code
returns null if it doesn't own the resource or if the interface is
wrong.
Change-Id: I904e0dd49dd6e535ef8cab6687c6869e1000048d
Reviewed-by: Johan Helsing <johan.helsing@theqtcompany.com>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Diffstat (limited to 'src/compositor/extensions/qwaylandshell.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandshell.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp index 633129b26..7965c9c6c 100644 --- a/src/compositor/extensions/qwaylandshell.cpp +++ b/src/compositor/extensions/qwaylandshell.cpp @@ -578,4 +578,15 @@ void QWaylandShellSurface::ping() d->ping(serial); } +/*! + * Returns the QWaylandShellSurface object associated with the given \a resource, or null if no such object exists. + */ +QWaylandShellSurface *QWaylandShellSurface::fromResource(wl_resource *resource) +{ + QWaylandShellSurfacePrivate::Resource *res = QWaylandShellSurfacePrivate::Resource::fromResource(resource); + if (res) + return static_cast<QWaylandShellSurfacePrivate *>(res->shell_surface_object)->q_func(); + return 0; +} + QT_END_NAMESPACE |