NAME
wlproxy - Represents a protocol object on the client side. SYNOPSIS
#include
Public Member Functions struct wlproxy * wlproxycreate (struct wlproxy *factory, const struct wlinterface *interface) void wlproxydestroy (struct wlproxy *proxy) int wlproxyaddlistener (struct wlproxy *proxy, void(**implementation)(void), void *data) const void * wlproxygetlistener (struct wlproxy *proxy) int wlproxyadddispatcher (struct wlproxy *proxy, wldispatcherfunct dispatcher, const void *implementation, void *data) struct wlproxy * wlproxymarshalarrayconstructor (struct wlproxy *proxy, uint32t opcode, union wlargument *args, const struct wlinterface *interface) struct wlproxy * wlproxymarshalarrayconstructorversioned (struct wlproxy *proxy, uint32t opcode, union wlargument *args, const struct wlinterface *interface, uint32t version) void wlproxymarshal (struct wlproxy *proxy, uint32t opcode,...) struct wlproxy * wlproxymarshalconstructor (struct wlproxy *proxy, uint32t opcode, const struct wlinterface *interface,...) struct wlproxy * wlproxymarshalconstructorversioned (struct wlproxy *proxy, uint32t opcode, const struct wlinterface *interface, uint32t version,...) void wlproxymarshalarray (struct wlproxy *proxy, uint32t opcode, union wlargument *args) void wlproxysetuserdata (struct wlproxy *proxy, void *userdata) void * wlproxygetuserdata (struct wlproxy *proxy) uint32t wlproxygetversion (struct wlproxy *proxy) uint32t wlproxygetid (struct wlproxy *proxy) const char * wlproxygetclass (struct wlproxy *proxy) void wlproxysetqueue (struct wlproxy *proxy, struct wleventqueue *queue) void * wlproxycreatewrapper (void *proxy) void wlproxywrapperdestroy (void *proxywrapper) Detailed Description Represents a protocol object on the client side. A wlproxy 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 wlproxymarshal() 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 wlproxyaddlistener(). Note: With the exception of function wlproxysetqueue(), functions accessing a wlproxy 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 wlproxyadddispatcher (struct wlproxy *proxy, wldispatcherfunctdispatcher, const void *implementation, void *data) Set a proxy's listener (with dispatcher) Parameters: proxy The proxy object dispatcher The dispatcher to be used for this proxy implementation The dispatcher-specific listener implementation data User data to be associated with the proxy Returns:
0 on success or -1 on failure Set proxy's listener to use dispatcherfunc as its dispatcher and
dispatcherdata 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 dispatcherdata 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. int wlproxyaddlistener (struct wlproxy *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. proxy must not be a proxy wrapper. struct wlproxy * wlproxycreate (struct wlproxy *factory, const struct wlinterface *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 wlproxymarshal(). 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: wldisplay, wleventqueue, wlproxymarshal() void * wlproxycreatewrapper (void *proxy)
Create a proxy wrapper for making queue assignments thread-safe Parameters: proxy The proxy object to be wrapped Returns: A proxy wrapper for the given proxy or NULL on failure A proxy wrapper is type of 'struct wlproxy' 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 wlproxywrapperdestroy(). 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 wldisplay proxy object before sending the wldisplay.sync request. For example: * * struct wleventqueue *queue = ...; * struct wldisplay *wrappeddisplay; * struct wlcallback *callback; * * wrappeddisplay = wlproxycreatewrapper(display); * wlproxysetqueue((struct wlproxy *) wrappeddisplay, queue); * callback = wldisplaysync(wrappeddisplay); * wlproxywrapperdestroy(wrappeddisplay); * wlcallbackaddlistener(callback, ...); * * void wlproxydestroy (struct wlproxy *proxy) Destroy a proxy object Parameters: proxy The proxy to be destroyed proxy must not be a proxy wrapper. const char * wlproxygetclass (struct wlproxy *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 uint32t wlproxygetid (struct wlproxy *proxy) Get the id of a proxy object Parameters: proxy The proxy object Returns: The id the object associated with the proxy const void * wlproxygetlistener (struct wlproxy *proxy) Get a proxy's listener Parameters: proxy The proxy object Returns: The address of the proxy's listener or NULL if no listener is set Gets the address to the proxy's listener; which is the listener set with wlproxyaddlistener. This function is useful in clients with multiple listeners on the same interface to allow the identification of which code to execute. void * wlproxygetuserdata (struct wlproxy *proxy) Get the user data associated with a proxy Parameters: proxy The proxy object Returns: The user data associated with proxy uint32t wlproxygetversion (struct wlproxy *proxy) Get the protocol object version of a proxy object Parameters: proxy The proxy object Returns: The protocol object version of the proxy or 0 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. wldisplay's version will always return 0. void wlproxymarshal (struct wlproxy *proxy, uint32topcode, ...) 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 This function is similar to wlproxymarshalconstructor(), except it
doesn't create proxies for new-id arguments. Note:
This should not normally be used by non-generated code. See Also: wlproxycreate() void wlproxymarshalarray (struct wlproxy *proxy, uint32topcode, union wlargument *args) Prepare a request to be sent to the compositor Parameters: proxy The proxy object opcode Opcode of the request to be sent args Extra arguments for the given request This function is similar to wlproxymarshalarrayconstructor(),
except it doesn't create proxies for new-id arguments. Note:
This is intended to be used by language bindings and not in non- generated code. See Also: wlproxymarshal() struct wlproxy * wlproxymarshalarrayconstructor (struct wlproxy *proxy, uint32topcode, union wlargument *args, const struct wlinterface *interface) Prepare a request to be sent to the compositor Parameters: proxy The proxy object opcode Opcode of the request to be sent args Extra arguments for the given request interface The interface to use for the new proxy This function translates a request given an opcode, an interface and a wlargument array to the wire format and writes it to the connection buffer.
For new-id arguments, this function will allocate a new wlproxy and send the ID to the server. The new wlproxy 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:
This is intended to be used by language bindings and not in non- generated code. See Also: wlproxymarshal() struct wlproxy * wlproxymarshalarrayconstructorversioned (struct wlproxy *proxy, uint32topcode, union wlargument *args, const struct wlinterface *interface, uint32tversion) Prepare a request to be sent to the compositor Parameters: proxy The proxy object opcode Opcode of the request to be sent args Extra arguments for the given request interface The interface to use for the new proxy version The protocol object version for the new proxy 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 wlargument.
For new-id arguments, this function will allocate a new wlproxy and send the ID to the server. The new wlproxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will have the version specified. Note:
This is intended to be used by language bindings and not in non- generated code. See Also: wlproxymarshal() struct wlproxy * wlproxymarshalconstructor (struct wlproxy *proxy, uint32topcode, const struct wlinterface *interface, ...) Prepare a request to be sent to the compositor Parameters: proxy The proxy object opcode Opcode of the request to be sent interface The interface to use for the new proxy ... Extra arguments for the given request Returns: A new wlproxy for the newid argument or NULL on error 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 wlproxy and send the ID to the server. The new wlproxy 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:
This should not normally be used by non-generated code. struct wlproxy * wlproxymarshalconstructorversioned (struct wlproxy *proxy, uint32topcode, const struct wlinterface *interface, uint32tversion, ...) Prepare a request to be sent to the compositor Parameters: proxy The proxy object opcode Opcode of the request to be sent interface The interface to use for the new proxy version The protocol object version of the new proxy ... Extra arguments for the given request Returns: A new wlproxy for the newid argument or NULL on error 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 wlproxy and send the ID to the server. The new wlproxy will be returned on success or NULL on error with errno set accordingly. The newly created proxy will have the version specified. Note:
This should not normally be used by non-generated code. void wlproxysetqueue (struct wlproxy *proxy, struct wleventqueue *queue) Assign a proxy to an event queue Parameters: proxy The proxy object queue The event queue that will handle this proxy or NULL 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: By default, the queue set in proxy is the one inherited from parent. See Also: wldisplaydispatchqueue() void wlproxysetuserdata (struct wlproxy *proxy, void *userdata) Set the user data associated with a proxy Parameters: proxy The proxy object userdata The data to be associated with proxy Set the user data associated with proxy. When events for this proxy are received, userdata will be supplied to its listener. void wlproxywrapperdestroy (void *proxywrapper) Destroy a proxy wrapper Parameters: proxywrapper The proxy wrapper to be destroyed Author Generated automatically by Doxygen for Wayland from the source code. Version 1.15.0 Tue Oct 30 2018 wlproxy(3)