Language bindings for wl_registry_bind request

Daniel Stone daniel at
Thu Jun 18 08:55:45 UTC 2020


On Thu, 18 Jun 2020 at 07:25, Brad Robinson
<brobinson at> wrote:
> 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.
> [...]
> 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?

Yeah, new_id with no interface gets expanded to new_id + interface
name + version:

Theoretically it applies to anything with that property, but in
reality the only user is wl_registry.bind.

It is generally not recommended to write your own bindings from
scratch, however. When you need to integrate with EGL, you need to
pass a pointer to the struct wl_display * for an EGLDisplay, and to
wl_surface * for an EGLSurface (via wl_egl_surface). Mesa internally
uses the C version of libwayland to send requests and receive events -
which will obviously not work with the C# implementation. The same is
true of Vulkan, GStreamer, and other libraries which integrate with

The recommended approach, avoiding these issues, is to wrap the
Wayland library using the 'dispatcher' methods provided; there is more
background here:


More information about the wayland-devel mailing list