wl_interface(3)

πŸ’– wl_interface β€” bestie, let's talk protocol objects πŸ’–

okay so this is wl_interface(3), a page from the Library Functions Manual, and it's genuinely one of those foundational Wayland things you're gonna keep bumping into. come sit with me 🫢


✨ NAME ✨

wl_interface β€” the whole vibe is: it's a struct that describes a protocol object's interface. that's it, that's the girl πŸ’…

🌸 SYNOPSIS 🌸

#include <wayland-util.h>

πŸŽ€ Data Fields πŸŽ€

  • const char * name
  • int version
  • int method_count
  • const struct wl_message * methods
  • int event_count
  • const struct wl_message * events

🌈 Detailed Description 🌈

πŸ¦‹ Protocol object interface πŸ¦‹

so, a wl_interface describes the API of a protocol object that's defined in the Wayland protocol specification. the protocol implementation uses a wl_interface inside its marshalling machinery to encode client requests. no cap, that's literally the job.

the name of a wl_interface is the name of the corresponding protocol interface, and version represents the version of that interface. meanwhile method_count and event_count represent the number of methods (aka requests) and events in the respective wl_message members. counting girlies, rise πŸ™Œ

for example, consider a protocol interface foo, marked as version 1, with two requests and one event.

<interface name="foo" version="1">
  <request name="a"></request>
  <request name="b"></request>
  <event name="c"></event>
</interface>

given two wl_message arrays foo_requests and foo_events, a wl_interface for foo might be:

struct wl_interface foo_interface = {
        "foo", 1,
        2, foo_requests,
        1, foo_events
};

πŸ’€ Note πŸ’€

the server side of the protocol may define interface implementation types that incorporate the term interface in their name. take care to not confuse these server-side structs with a wl_interface variable whose name also ends in interface. for example, while the server may define a type struct wl_foo_interface, the client may define a struct wl_interface wl_foo_interface. same word, different girlies β€” do not mix them up, i'm begging 😭

πŸ‘€ See also πŸ‘€

  • wl_message
  • wl_proxy
  • Interfaces
  • Versioning

πŸ”₯ Field Documentation πŸ”₯

πŸ’œ int wl_interface::event_count

number of events ✨

πŸ’œ const struct wl_message* wl_interface::events

event signatures ✨

πŸ’œ int wl_interface::method_count

number of methods (requests) ✨

πŸ’œ const struct wl_message* wl_interface::methods

method (request) signatures ✨

πŸ’œ const char* wl_interface::name

interface name ✨

πŸ’œ int wl_interface::version

interface version ✨


πŸ‘‘ Author πŸ‘‘

generated automatically by Doxygen for Wayland from the source code. so nobody hand-wrote this one, it's a robot's magnum opus πŸ€–πŸ’…


and that's the whole page bestie!! this one's from Wayland, Version 1.26.0 β€” go forth and marshal your requests, ily, mwah πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from