Re: Language bindings for wl_registry_bind request
Hi Pekka, 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. > Great - glad to see this explicitly spelled out. Brad ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: Language bindings for wl_registry_bind request
On Thu, 18 Jun 2020 16:25:14 +1000 Brad Robinson 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) > >Binds a new, client-created object to the server using > the specified name as the identifier. name="name" type="uint" summary="unique numeric name of the object"/> > > > > > 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 pgp8O74QZxR7k.pgp Description: OpenPGP digital signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: Language bindings for wl_registry_bind request
Hi, On Thu, 18 Jun 2020 at 07:25, Brad Robinson 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) > > > > Binds a new, client-created object to the server using the > specified name as the identifier. > > > > > > > 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: https://gitlab.freedesktop.org/wayland/wayland/-/blob/master/src/scanner.c#L1233 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 Wayland. The recommended approach, avoiding these issues, is to wrap the Wayland library using the 'dispatcher' methods provided; there is more background here: https://smithay.github.io/wayland-rs-v-0-21.html Cheers, Daniel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel