Language bindings for wl_registry_bind request

Pekka Paalanen ppaalanen at gmail.com
Thu Jun 18 09:38:36 UTC 2020


On Thu, 18 Jun 2020 16:25:14 +1000
Brad Robinson <brobinson at toptensoftware.com> wrote:

> Hi All,
> 
> I'm putting together a set of C# bindings for Wayland and it's coming along
> nicely but I've hit an issue with wl_registry_bind where its implementation
> doesn't seem to match the xml.
> 
> The wayland.xml file declares it as: (essentially one input parameter -
> name)
> 
>     <request name="bind">      <description summary="bind an object to
> the display">	Binds a new, client-created object to the server using
> the	specified name as the identifier.      </description>      <arg
> name="name" type="uint" summary="unique numeric name of the object"/>
>     <arg name="id" type="new_id" summary="bounded object"/>
> </request>
> 
> 
> But the C implementation has additional version and interface parameters
> and uses the wl_proxy_marshal_constructor_versioned - with apparently no
> hints in the xml as to why.
> 
> static inline void *
> wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const
> struct wl_interface *interface, uint32_t version)
> {
>      struct wl_proxy *id;
> 
>      id = wl_proxy_marshal_constructor_versioned((struct wl_proxy *)
> wl_registry,
>          WL_REGISTRY_BIND, interface, version, name, interface->name,
> version, NULL);
> 
>      return (void *) id;
> }
> 
> Similarly the xml file would suggest the message signature should be "un",
> but the C bindings have it as "usun".
> 
> What's going on here?  Is this a special case for this one method?

Hi,

the rule is that a 'new_id' type of argument *without* an 'interface'
attribute extends to three arguments instead of one. The interface must
be known at runtime, and if the XML does not give it, then it must be
transmitted explicitly.

This would apply to all requests that use a 'new_id' argument without
'interface' defined, but in the core only wl_registry.bind has it.

This is quite poorly documented, I think we're missing it completely in
the upstream doc. It is mentioned in
https://ppaalanen.blogspot.com/2014/07/wayland-protocol-design-object-lifespan.html
which is no excuse to not have it in the proper docs.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20200618/0941c436/attachment.sig>


More information about the wayland-devel mailing list