Skip to main content

Module wlclient

Module wlclient 

Source
Expand description

Shared plumbing for outbound Wayland client connections. Shared plumbing for pixelflux’s outbound Wayland CLIENT connections (the virtual-keyboard typer and the data-control clipboard bridge, both talking to a nested app compositor): socket resolution, deadline-bounded round-trips so a wedged compositor turns into an error instead of a hang, and fd read/write helpers for clipboard pipes.

MacrosΒ§

impl_sync_callback πŸ”’
Dispatch<WlCallback> for a SyncState type (a blanket impl would violate the orphan rule, so each state stamps its own).

ConstantsΒ§

IO_TIMEOUT πŸ”’
READ_CAP_MAX πŸ”’
Ceiling on an unbounded clipboard source, matching what the selkies clipboard protocol allows: a hostile or stuck peer could otherwise stream bytes into memory forever.

TraitsΒ§

SyncState πŸ”’
Implemented by every client state so bounded_roundtrip can flag the sync callback’s completion; pair with impl_sync_callback.

FunctionsΒ§

bounded_roundtrip πŸ”’
EventQueue::roundtrip with a deadline: a wedged compositor becomes an error instead of hanging the calling thread (and everything queued behind it).
drain_pipe πŸ”’
Drain every pending byte from a wake pipe without blocking.
memfd_with πŸ”’
Anonymous CLOEXEC memfd holding data (keymap uploads, shm-style payloads).
pipe_cloexec πŸ”’
CLOEXEC pipe as (read end, write end).
read_fd_to_end πŸ”’
Read fd to EOF. The deadline is per-chunk (idle), so a large transfer that keeps flowing is never cut off while a stalled writer still errors out.
read_fd_to_end_capped πŸ”’
Same as read_fd_to_end but refuses a source larger than cap.
socket_path πŸ”’
Absolute socket path for a Wayland display name (absolute paths pass through, names join XDG_RUNTIME_DIR).
wait_readable πŸ”’
Block until fd is readable or timeout passes (false = timed out).
wait_readable2 πŸ”’
Poll two fds for readability at once (wayland socket + a wake pipe); returns (a_readable, b_readable), both false on timeout. Hangup counts as readable so a closed wake pipe unblocks its waiter.
wake_pipe πŸ”’
Non-blocking CLOEXEC pipe for wake signaling (read end, write end).
wake_write πŸ”’
One wake byte, non-blocking; a full pipe already guarantees a pending wake.
write_fd_all πŸ”’
Write all of data to fd, tolerating a slow reader up to idle per chunk. EPIPE is success-shaped: the paster stopped reading, which is its right.
write_fd_all_nb πŸ”’