wl_proxy(3) | Wayland | wl_proxy(3) |
wl_proxy - Represents a protocol object on the client side.
#include <wayland-client-core.h>
struct wl_proxy * wl_proxy_create (struct
wl_proxy *factory, const struct wl_interface *interface)
void wl_proxy_destroy (struct wl_proxy *proxy)
int wl_proxy_add_listener (struct wl_proxy *proxy,
void(**implementation)(void), void *data)
const void * wl_proxy_get_listener (struct wl_proxy *proxy)
int wl_proxy_add_dispatcher (struct wl_proxy *proxy,
wl_dispatcher_func_t dispatcher, const void *implementation, void
*data)
struct wl_proxy * wl_proxy_marshal_array_constructor (struct
wl_proxy *proxy, uint32_t opcode, union wl_argument *args,
const struct wl_interface *interface)
struct wl_proxy * wl_proxy_marshal_array_constructor_versioned
(struct wl_proxy *proxy, uint32_t opcode, union wl_argument
*args, const struct wl_interface *interface, uint32_t version)
void wl_proxy_marshal (struct wl_proxy *proxy, uint32_t
opcode,...)
struct wl_proxy * wl_proxy_marshal_constructor (struct
wl_proxy *proxy, uint32_t opcode, const struct wl_interface
*interface,...)
struct wl_proxy * wl_proxy_marshal_constructor_versioned (struct
wl_proxy *proxy, uint32_t opcode, const struct wl_interface
*interface, uint32_t version,...)
void wl_proxy_marshal_array (struct wl_proxy *proxy, uint32_t
opcode, union wl_argument *args)
void wl_proxy_set_user_data (struct wl_proxy *proxy, void
*user_data)
void * wl_proxy_get_user_data (struct wl_proxy *proxy)
uint32_t wl_proxy_get_version (struct wl_proxy *proxy)
uint32_t wl_proxy_get_id (struct wl_proxy *proxy)
void wl_proxy_set_tag (struct wl_proxy *proxy, const char *const
*tag)
const char *const * wl_proxy_get_tag (struct wl_proxy *proxy)
const char * wl_proxy_get_class (struct wl_proxy *proxy)
void wl_proxy_set_queue (struct wl_proxy *proxy, struct
wl_event_queue *queue)
void * wl_proxy_create_wrapper (void *proxy)
void wl_proxy_wrapper_destroy (void *proxy_wrapper)
Represents a protocol object on the client side.
A wl_proxy acts as a client side proxy to an object existing in the compositor. The proxy is responsible for converting requests made by the clients with wl_proxy_marshal() into Wayland's wire format. Events coming from the compositor are also handled by the proxy, which will in turn call the handler set with wl_proxy_add_listener().
Note
Set a proxy's listener (with dispatcher)
Parameters
Returns
Set proxy's listener to use dispatcher_func as its dispatcher and dispatcher_data as its dispatcher-specific implementation and its user data to data. If a listener has already been set, this function fails and nothing is changed.
The exact details of dispatcher_data depend on the dispatcher used. This function is intended to be used by language bindings, not user code.
proxy must not be a proxy wrapper.
Set a proxy's listener
Parameters
Returns
Set proxy's listener to implementation and its user data to data. If a listener has already been set, this function fails and nothing is changed.
implementation is a vector of function pointers. For an opcode n, implementation[n] should point to the handler of n for the given object.
proxy must not be a proxy wrapper.
Create a proxy object with a given interface
Parameters
Returns
This function creates a new proxy object with the supplied interface. The proxy object will have an id assigned from the client id space. The id should be created on the compositor side by sending an appropriate request with wl_proxy_marshal().
The proxy will inherit the display and event queue of the factory object.
Note
See also
Create a proxy wrapper for making queue assignments thread-safe
Parameters
Returns
A proxy wrapper is type of 'struct wl_proxy' instance that can be used when sending requests instead of using the original proxy. A proxy wrapper does not have an implementation or dispatcher, and events received on the object is still emitted on the original proxy. Trying to set an implementation or dispatcher will have no effect but result in a warning being logged.
Setting the proxy queue of the proxy wrapper will make new objects created using the proxy wrapper use the set proxy queue. Even though there is no implementation nor dispatcher, the proxy queue can be changed. This will affect the default queue of new objects created by requests sent via the proxy wrapper.
A proxy wrapper can only be destroyed using wl_proxy_wrapper_destroy().
A proxy wrapper must be destroyed before the proxy it was created from.
If a user reads and dispatches events on more than one thread, it is necessary to use a proxy wrapper when sending requests on objects when the intention is that a newly created proxy is to use a proxy queue different from the proxy the request was sent on, as creating the new proxy and then setting the queue is not thread safe.
For example, a module that runs using its own proxy queue that needs to do display roundtrip must wrap the wl_display proxy object before sending the wl_display.sync request. For example:
struct wl_event_queue *queue = ...; struct wl_display *wrapped_display; struct wl_callback *callback; wrapped_display = wl_proxy_create_wrapper(display); wl_proxy_set_queue((struct wl_proxy *) wrapped_display, queue); callback = wl_display_sync(wrapped_display); wl_proxy_wrapper_destroy(wrapped_display); wl_callback_add_listener(callback, ...);
Destroy a proxy object
Parameters
proxy must not be a proxy wrapper.
Get the interface name (class) of a proxy object
Parameters
Returns
Get the id of a proxy object
Parameters
Returns
Get a proxy's listener
Parameters
Returns
Gets the address to the proxy's listener; which is the listener set with wl_proxy_add_listener.
This function is useful in clients with multiple listeners on the same interface to allow the identification of which code to execute.
Get the tag of a proxy object
See wl_proxy_set_tag for details.
Parameters
Since
Get the user data associated with a proxy
Parameters
Returns
Get the protocol object version of a proxy object
Parameters
Returns
Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API.
A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version.
wl_display's version will always return 0.
Prepare a request to be sent to the compositor
Parameters
This function is similar to wl_proxy_marshal_constructor(), except it doesn't create proxies for new-id arguments.
Note
See also
Prepare a request to be sent to the compositor
Parameters
This function is similar to wl_proxy_marshal_array_constructor(), except it doesn't create proxies for new-id arguments.
Note
See also
Prepare a request to be sent to the compositor
Parameters
This function translates a request given an opcode, an interface and a wl_argument array to the wire format and writes it to the connection buffer.
For new-id arguments, this function will allocate a new wl_proxy and send the ID to the server. The new wl_proxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will inherit their version from their parent.
Note
See also
Prepare a request to be sent to the compositor
Parameters
Translates the request given by opcode and the extra arguments into the wire format and write it to the connection buffer. This version takes an array of the union type wl_argument.
For new-id arguments, this function will allocate a new wl_proxy and send the ID to the server. The new wl_proxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will have the version specified.
Note
See also
Prepare a request to be sent to the compositor
Parameters
Returns
This function translates a request given an opcode, an interface and extra arguments to the wire format and writes it to the connection buffer. The types of the extra arguments must correspond to the argument types of the method associated with the opcode in the interface.
For new-id arguments, this function will allocate a new wl_proxy and send the ID to the server. The new wl_proxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will inherit their version from their parent.
Note
Prepare a request to be sent to the compositor
Parameters
Returns
Translates the request given by opcode and the extra arguments into the wire format and write it to the connection buffer.
For new-id arguments, this function will allocate a new wl_proxy and send the ID to the server. The new wl_proxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will have the version specified.
Note
Assign a proxy to an event queue
Parameters
Assign proxy to event queue. Events coming from proxy will be queued in queue from now. If queue is NULL, then the display's default queue is set to the proxy.
Note
See also
Set the tag of a proxy object
A toolkit or application can set a unique tag on a proxy in order to identify whether an object is managed by itself or some external part.
To create a tag, the recommended way is to define a statically allocated constant char array containing some descriptive string. The tag will be the pointer to the non-const pointer to the beginning of the array.
For example, to define and set a tag on a surface managed by a certain subsystem:
static const char *my_tag = "my tag";
wl_proxy_set_tag((struct wl_proxy *) surface, &my_tag);
Then, in a callback with wl_surface as an argument, in order to check whether it's a surface managed by the same subsystem.
const char * const *tag;
tag = wl_proxy_get_tag((struct wl_proxy *) surface);
if (tag != &my_tag)
return;
...
For debugging purposes, a tag should be suitable to be included in a debug log entry, e.g.
const char * const *tag;
tag = wl_proxy_get_tag((struct wl_proxy *) surface);
printf("Got a surface with the tag %p (%s)0,
tag, (tag && *tag) ? *tag : "");
Parameters
Since
Set the user data associated with a proxy
Parameters
Set the user data associated with proxy. When events for this proxy are received, user_data will be supplied to its listener.
Destroy a proxy wrapper
Parameters
Generated automatically by Doxygen for Wayland from the source code.
Mon Aug 31 2020 | Version 1.18.0 |