wl_message(3)
π NAME π
wl_message β the little struct that spills the tea on what a protocol message actually looks like, bestie π
(this page lives in the Library Functions Manual, section 3, so yes she's a library function situation)
πΈ SYNOPSIS πΈ
#include <wayland-util.h>
β¨ Data Fields β¨
const char * nameconst char * signatureconst struct wl_interface ** types
π Detailed Description π
Protocol message signature π¦
Okay so picture this: a wl_message describes the signature of an actual protocol message β like a request or an event β and it has to play by the rules of the Wayland protocol wire format. The protocol implementation uses a wl_message inside its demarshal machinery to decode messages going back and forth between a compositor and its clients. In a sense, a wl_message is to a protocol message like a class is to an object. periodt. π
The name of a wl_message is the name of the corresponding protocol message. iconic, no notes.
The signature is an ordered list of symbols representing the data types of message arguments and, optionally, a protocol version and indicators for nullability. A leading integer in the signature indicates the since version of the protocol message. A ? preceding a data type symbol indicates that the following argument type is nullable.
π¨ Okay serious moment, bestie: while it is a protocol violation to send messages with non-nullable arguments set toNULL, event handlers in clients might still get called with non-nullable object arguments set toNULL. This can happen when the client destroyed the object being used as argument on its side and an event referencing that object was sent before the server knew about its destruction. As this race cannot be prevented, clients should β as a general rule β program their event handlers such that they can handle object arguments declared non-nullable beingNULLgracefully. π not the race condition.
When no arguments accompany a message, signature is an empty string. (yes, literally empty, it's giving minimalism π)
π€ Symbols π€
i:intu:uintf:fixeds:stringo:objectn:new_ida:arrayh:fd?: following argument (oors) is nullable
While demarshaling primitive arguments is straightforward, when demarshaling messages containing object or new_id arguments, the protocol implementation often must determine the type of the object. The types of a wl_message is an array of wl_interface references that correspond to o and n arguments in signature, with NULL placeholders for arguments with non-object types. π«Ά
Consider the protocol event wl_display delete_id that has a single uint argument. The wl_message is:
{ "delete_id", "u", [NULL] }
Here, the message name is "delete_id", the signature is "u", and the argument types is [NULL], indicating that the uint argument has no corresponding wl_interface since it is a primitive argument. simple. clean. slay. β¨
In contrast, consider a wl_foo interface supporting protocol request bar that has existed since version 2, and has two arguments: a uint and an object of type wl_baz_interface that may be NULL. Such a wl_message might be:
{ "bar", "2u?o", [NULL, &wl_baz_interface] }
Here, the message name is "bar", and the signature is "2u?o". Notice how the 2 indicates the protocol version, the u indicates the first argument type is uint, and the ?o indicates that the second argument is an object that may be NULL. Lastly, the argument types array indicates that no wl_interface corresponds to the first argument, while the type wl_baz_interface corresponds to the second argument. ate that explanation up fr fr π
π See also π
wl_argumentwl_interfaceWire Format
π Field Documentation π
π const char* wl_message::name π
Message name β the whole identity, the name tag, the "hi my name is" sticker π
π const char* wl_message::signature π
Message signature β the symbol soup that says what the args are π§
π const struct wl_interface** wl_message::types π
Object argument interfaces β the lookup table for your o and n girls π
βοΈ Author βοΈ
Generated automatically by Doxygen for Wayland from the source code. (not a human author, just the robot doing its little thing π€β¨)
and that's the whole page, bestie! this one came from Wayland, Version 1.26.0, and it's the wl_message(3) page β so next time you see a signature string like "2u?o" just know you're fluent now ππ¦ periodt.
π¦ where this page comes from
- arch rolling: wayland-docs 1.26.0-1 Β· MIT
- fedora 44: wayland-devel 1.26.0-1.fc44 Β· MIT
- fedora 44: wayland-devel 1.26.0-1.fc44 Β· MIT
- nixpkgs unstable: wayland 1.26.0
- ubuntu stonking: libwayland-doc 1.26.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms