[PATCH wayland 2/5] Add API to retrieve the interface of a wl_resource

Giulio Camuffo giuliocamuffo at gmail.com
Fri Jun 17 11:31:40 UTC 2016


2016-06-17 14:09 GMT+03:00 Pekka Paalanen <ppaalanen at gmail.com>:
> On Mon,  7 Mar 2016 18:31:32 +0100
> Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
>
>> ---
>>  src/wayland-server-core.h |  2 ++
>>  src/wayland-server.c      | 12 ++++++++++++
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
>> index 1bc4d6b..a4ca350 100644
>> --- a/src/wayland-server-core.h
>> +++ b/src/wayland-server-core.h
>> @@ -419,6 +419,8 @@ int
>>  wl_resource_instance_of(struct wl_resource *resource,
>>                       const struct wl_interface *interface,
>>                       const void *implementation);
>> +const struct wl_interface *
>> +wl_resource_get_interface(struct wl_resource *resource);
>>
>>  void
>>  wl_resource_add_destroy_listener(struct wl_resource *resource,
>> diff --git a/src/wayland-server.c b/src/wayland-server.c
>> index 2857b1d..5099614 100644
>> --- a/src/wayland-server.c
>> +++ b/src/wayland-server.c
>> @@ -687,6 +687,18 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
>>       return wl_signal_get(&resource->destroy_signal, notify);
>>  }
>>
>> +/** Retrieve the interface of a resource.
>> + *
>> + * \param resource The resource object
>> + *
>> + * \memberof wl_resource
>> + */
>> +WL_EXPORT const struct wl_interface *
>> +wl_resource_get_interface(struct wl_resource *resource)
>> +{
>> +     return resource->object.interface;
>> +}
>> +
>>  WL_EXPORT void
>>  wl_client_add_destroy_listener(struct wl_client *client,
>>                              struct wl_listener *listener)
>
> Hi,
>
> is it necessary to get the wl_interface pointer, or would it be enough
> to get just the interface name, similar to wl_proxy_get_class()?

The name would be enough for me, i guess for simmetry purposes it may be better.

Thanks,
Giulio

>
>
> Thanks,
> pq


More information about the wayland-devel mailing list