From 272904313b1a36dad73bc380596fea94a89a3d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 9 Feb 2015 14:30:32 +0100 Subject: [PATCH] [server] Add quint32 Resource::id() const Wrapper for wl_resource_get_id. --- src/wayland/server/resource.cpp | 8 ++++++++ src/wayland/server/resource.h | 7 +++++++ 2 files changed, 15 insertions(+) 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;