package wayland
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=cdeca72c7ff949cbd0fb4d1e1141e4cf7aa75368db7ced4667dd4404e0fbec2c
sha512=815a0987a184615df39e0acfb912fbdd7ba2a1ae1e65267d9eeac6a63afe9d205c4d3c335b92f770227ecc93cd88f8e65e84328cd3dc17523b5eb42676e032ee
doc/wayland/Wayland/Proxy/index.html
Module Wayland.Proxy
Source
A proxy corresponds to an object on the connection.
Types
An ('a, 'v, 'role) t
is a proxy used by 'role
to send messages to an object with interface 'a
and version in 'v
.
user_data t
returns the data attached to the proxy when it was created.
This just calls the application's user_data
method, if any. Returns No_data
if nothing was attached.
If the version rules turn out to be too restrictive, this can be used to disable them.
Using this incorrectly may lead to a protocol error (such as receiving an event for which no handler was registered).
Metadata
Lifecycle
delete t
removes t
from the object table. For servers, it also sends a delete event from object 1 if the object was client-allocated.
on_delete t f
calls f
when t
is deleted, either by delete
being called (on the server) or when the client receives confirmation of the deletion from the server. f
will also be called if the connection ends.
can_send t
is true
if the proxy can still be used in out-going messages. It becomes false after calling delete
or shutdown_send
.
transport_up t
is true
if t
's connection is still active. This is false
after we read or send end-of-file on the connection.
Handlers
type ('a, 'v, 'role) proxy := ('a, 'v, 'role) t
Alias for use inside this file only
Handlers for services (objects added via the registry).
Functions for use by generated code
You should not need to use these functions directly. Instead, run wayland-scanner-ocaml to generate typed wrappers and use the wrappers instead.
id t
is t
's object ID. Use this to refer to the object in a message.
val alloc :
('a, _, _) t ->
op:int ->
ints:int ->
strings:string option list ->
arrays:string list ->
('a, [ `W ]) Msg.t
alloc t ~op ~ints ~strings ~arrays
is a fresh message for t
's op
operation. The message is the right size for ints
integer arguments, all the strings in strings
, and all the arrays in arrays
.
send t msg
enqueues msg
on t
's connection.
val spawn :
(_, 'v, [< `Client | `Server ] as 'role) t ->
['a, 'v, 'role] Handler.t ->
('a, 'v, 'role) t
Create a new proxy on t
's connection with an unused ID. The new object has the same version as its parent.
val spawn_bind :
(_, _, [< `Client | `Server ] as 'role) t ->
(['a, 'v, 'role] Service_handler.t * int32) ->
('a, 'v, 'role) t
Like spawn
but the child's version is given explicitly, not inherited from the parent. This is used for binding with the global registry.
shutdown_send t
indicates that you will no longer call send
on t
. Call this after sending a destructor message. Attempts to send using the proxy after this will fail.
shutdown_recv t
indicates that we will no longer receive messages addressed to t
. Call this after receiving a destructor message.
A suitable string to display for an unknown event number.
A suitable string to display for an unknown request number.
Logging and tracing
Pass a TRACE
module when connecting to trace protocol messages.