wl_resource(3)
πβ¨ wl_resource β¨π
okay bestie, pull up a chair, because we're diving into the wl_resource(3) page from the Wayland crew and it's lowkey iconic π¦ this is the thing you read when you want to know how a resource object works on the server side β all its little functions, all its data fields, the whole vibe. no cap, it's giving "backstage pass to the compositor" energy π
πΈ SYNOPSIS πΈ
first things first, you gotta include the header, fr fr:
#include <wayland-server.h>
β¨ Public Member Functions β¨
here's the whole squad of functions, copy-pasted exactly so you don't get it twisted:
void wl_resource_post_error_vargs (struct wl_resource *resource,
uint32_t code, const char *msg, va_list argp)
void wl_resource_post_error (struct wl_resource *resource, uint32_t
code, const char *msg,...)
const char * wl_resource_get_class (const struct wl_resource *resource)
const struct wl_interface * wl_resource_get_interface (struct
wl_resource *resource)
struct wl_resource * wl_resource_create (struct wl_client *client, const
struct wl_interface *interface, int version, uint32_t id)
π Data Fields π
and the fields inside the struct, absolutely every single one, no skipping:
struct wl_object objectwl_resource_destroy_func_t destroystruct wl_list linkstruct wl_signal deprecated_destroy_signalstruct wl_client * clientvoid * dataint versionwl_dispatcher_func_t dispatcherstruct wl_priv_signal destroy_signalstruct wl_signal destroy_signal
π Member Function Documentation π
π struct wl_resource * wl_resource_create (struct wl_client * client, const struct wl_interface * interface, int version, uint32_t id)
Create a new resource object β yes bestie, it literally makes a whole new resource, main character behavior π«
Parameters:
- client β The client owner of the new resource. it's their baby πΌ
- interface β The interface of the new resource.
- version β The version of the new resource.
- id β The id of the new resource. If
0, an available id will be used. (so if you pass a big ol' zero, the system picks a free one for you, slay π«Ά)
Listeners added with wl_client_add_resource_created_listener will be notified at the end of this function. so like, they get the news at the very end, not before. periodt.
π¦ const char * wl_resource_get_class (const struct wl_resource * resource)
Retrieve the interface name (class) of a resource object. it's the name reveal moment β¨
Parameters:
- resource β The resource object
β const struct wl_interface * wl_resource_get_interface (struct wl_resource * resource)
Get the interface of a resource object β like asking "so what are you, actually?" π
Parameters:
- resource β The resource object
Returns:
- The interface of the object associated with the resource
Since:
1.24β she's new-ish, a little baby, treat her well π
π₯ void wl_resource_post_error (struct wl_resource * resource, uint32_t code, const char * msg, ...)
Post a protocol error β yeah it's the "bestie we have a problem" function π
Parameters:
- resource β The resource object
- code β The error code
- msg β The error message format string
- ... β The format string arguments
π void wl_resource_post_error_vargs (struct wl_resource * resource, uint32_t code, const char * msg, va_list argp)
Post a protocol error β same energy as above, but you're handing it a whole argument list instead of loose args. va_list girlies rise up π
Parameters:
- resource β The resource object
- code β The error code
- msg β The error message format string
- argp β The format string argument list
π§ Field Documentation π§
these fields are listed here with no extra commentary in the original, and honestly? same, they're just vibing πΈ
struct wl_client * wl_resource::clientvoid * wl_resource::datastruct wl_signal wl_resource::deprecated_destroy_signalwl_resource_destroy_func_t wl_resource::destroystruct wl_priv_signal wl_resource::destroy_signalstruct wl_signal wl_resource::destroy_signalwl_dispatcher_func_t wl_resource::dispatcherstruct wl_list wl_resource::linkstruct wl_object wl_resource::objectint wl_resource::version
heads up cutie: there are literally two things namedwl_resource::destroy_signalin this list β one is astruct wl_priv_signaland one is astruct wl_signal. i'm not making that up, that's just what the page says. do not come for me π
π Author π
Generated automatically by Doxygen for Wayland from the source code. (not a human, just a lil robot doing its thing π€π)
aaaand that's the whole page bestie, you ate it, you understood it, you're basically a Wayland dev now π this was Wayland, Version 1.26.0, and the page you just read is wl_resource(3) β stay hydrated, keep your resources destroyed properly, mwah πβ¨π¦
π¦ where this page comes from
- fedora 43: wayland-devel 1.26.0-1.fc43 Β· MIT
- fedora 43: wayland-devel 1.26.0-1.fc43 Β· MIT
- 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