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 aSyncStatetype (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Β§
- Sync
State π - Implemented by every client state so
bounded_roundtripcan flag the sync callbackβs completion; pair withimpl_sync_callback.
FunctionsΒ§
- bounded_
roundtrip π EventQueue::roundtripwith 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
fdto 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_endbut refuses a source larger thancap. - socket_
path π - Absolute socket path for a Wayland display name (absolute paths pass through, names join XDG_RUNTIME_DIR).
- wait_
readable π - Block until
fdis readable ortimeoutpasses (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
datatofd, tolerating a slow reader up toidleper chunk. EPIPE is success-shaped: the paster stopped reading, which is its right. - write_
fd_ πall_ nb