diff --git a/src/wayland/server/resource.cpp b/src/wayland/server/resource.cpp index 0e128249cc..5ee2e46a8f 100644 --- a/src/wayland/server/resource.cpp +++ b/src/wayland/server/resource.cpp @@ -100,5 +100,13 @@ wl_resource *Resource::parentResource() const return d->parentResource; } +quint32 Resource::id() const +{ + if (!d->resource) { + return 0; + } + return wl_resource_get_id(d->resource); +} + } } diff --git a/src/wayland/server/resource.h b/src/wayland/server/resource.h index 38355c4609..a501bf72d9 100644 --- a/src/wayland/server/resource.h +++ b/src/wayland/server/resource.h @@ -46,6 +46,13 @@ public: ClientConnection *client(); Global *global(); wl_resource *parentResource() const; + /** + * @returns The id of this Resource if it is created, otherwise @c 0. + * + * This is a convenient wrapper for wl_resource_get_id. + * @since 5.3 + **/ + quint32 id() const; protected: class Private;