wl_proxy(3) Wayland wl_proxy(3)NAME
wl_proxy -
Represents a protocol object on the client side.
SYNOPSIS
#include <wayland-client.h>
Public Member Functions
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)
void wl_proxy_marshal (struct wl_proxy *proxy, uint32_t opcode,...)
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_id (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)
Detailed Description
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:
With the exception of function wl_proxy_set_queue(), functions
accessing a wl_proxy are not normally used by client code. Clients
should normally use the higher level interface generated by the
scanner to interact with compositor objects.
Member Function Documentation
int wl_proxy_add_listener (struct wl_proxy *proxy,
void(**)(void)implementation, void *data)
Set a proxy's listener
Parameters:
proxy The proxy object
implementation The listener to be added to proxy
data User data to be associated with the proxy
Returns:
0 on success or -1 on failure
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.
struct wl_proxy * wl_proxy_create (struct wl_proxy *factory, const struct
wl_interface *interface)
Create a proxy object with a given interface
Parameters:
factory Factory proxy object
interface Interface the proxy object should use
Returns:
A newly allocated proxy object or NULL on failure
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:
This should not normally be used by non-generated code.
See Also:
wl_display, wl_event_queue, wl_proxy_marshal()
void wl_proxy_destroy (struct wl_proxy *proxy)
Destroy a proxy object
Parameters:
proxy The proxy to be destroyed
const char * wl_proxy_get_class (struct wl_proxy *proxy)
Get the interface name (class) of a proxy object
Parameters:
proxy The proxy object
Returns:
The interface name of the object associated with the proxy
uint32_t wl_proxy_get_id (struct wl_proxy *proxy)
Get the id of a proxy object
Parameters:
proxy The proxy object
Returns:
The id the object associated with the proxy
void * wl_proxy_get_user_data (struct wl_proxy *proxy)
Get the user data associated with a proxy
Parameters:
proxy The proxy object
Returns:
The user data associated with proxy
void wl_proxy_marshal (struct wl_proxy *proxy, uint32_topcode, ...)
Prepare a request to be sent to the compositor
Parameters:
proxy The proxy object
opcode Opcode of the request to be sent
... Extra arguments for the given request
Translates the request given by opcode and the extra arguments into the
wire format and write it to the connection buffer.
The example below creates a proxy object with the wl_surface_interface
using a wl_compositor factory interface and sends the
compositor.create_surface request using wl_proxy_marshal(). Note the id
is the extra argument to the request as specified by the protocol.
* id = wl_proxy_create((struct wl_proxy *) wl_compositor,
* &wl_surface_interface);
* wl_proxy_marshal((struct wl_proxy *) wl_compositor,
* WL_COMPOSITOR_CREATE_SURFACE, id);
*
Note:
This should not normally be used by non-generated code.
See Also:
wl_proxy_create()
void wl_proxy_set_queue (struct wl_proxy *proxy, struct wl_event_queue
*queue)
Assign a proxy to an event queue
Parameters:
proxy The proxy object
queue The event queue that will handle this proxy
Assign proxy to event queue. Events coming from proxy will be queued in
queue instead of the display's main queue.
See Also:
wl_display_dispatch_queue()
void wl_proxy_set_user_data (struct wl_proxy *proxy, void *user_data)
Set the user data associated with a proxy
Parameters:
proxy The proxy object
user_data The data to be associated with proxy
Set the user data associated with proxy. When events for this proxy are
received, user_data will be supplied to its listener.
Author
Generated automatically by Doxygen for Wayland from the source code.
Version 1.2.1 Fri Oct 18 2013 wl_proxy(3)