Struct wayland_server::Display
[−]
[src]
pub struct Display { /* fields omitted */ }
A wayland socket
This represents a socket your compositor can receive clients on.
Methods
impl Display
[src]
fn add_socket<S>(&mut self, name: Option<S>) -> IoResult<()> where S: AsRef<OsStr>
Add a listening socket to this display
Wayland clients will be able to connect to your compositor from this socket.
Socket will be created in the directory specified by the environment variable
XDG_RUNTIME_DIR
.
If a name is provided, it is used. Otherwise, if WAYLAND_DISPLAY
environment
variable is set, its contents are used as socket name. Otherwise, wayland-0
is used.
Errors if name
contains an interior null, or if XDG_RUNTIME_DIR
is not set,
or if specified could not be bound (either it is already used or the compositor
does not have the rights to create it).
fn add_socket_auto(&mut self) -> IoResult<OsString>
Add an automatically named listening socket to this display
Wayland clients will be able to connect to your compositor from this socket.
Socket will be created in the directory specified by the environment variable
XDG_RUNTIME_DIR
. The directory is scanned for any name in the form wayland-$d
with
0 <= $d < 32
and the first available one is used.
Errors if XDG_RUNTIME_DIR
is not set, or all 32 names are already in use.
fn add_socket_from<T>(&mut self, socket: T) -> IoResult<()> where T: IntoRawFd
Add existing listening socket to this display
Wayland clients will be able to connect to your compositor from this socket.
The existing socket fd must already be created, opened, and locked. The fd must be properly set to CLOEXEC and bound to a socket file with both bind() and listen() already called. An error is returned otherwise.
unsafe fn add_socket_fd(&mut self, fd: RawFd) -> IoResult<()>
Add existing listening socket to this display from a raw file descriptor
Wayland clients will be able to connect to your compositor from this socket.
The library takes ownership of the provided socket if this method returns successfully.
The existing socket fd must already be created, opened, and locked. The fd must be properly set to CLOEXEC and bound to a socket file with both bind() and listen() already called. An error is returned otherwise.
fn flush_clients(&self)
Flush events to the clients
Will send as many pending events as possible to the respective sockets of the clients. Will not block, but might not send everything if the socket buffer fills up.