Expand description
KDE client growing, removing, and arranging a nested KWin session’s screens. KDE session-screen client: grows, removes, and arranges the screens of a nested KWin session, in-process.
KWin serves no control socket; its interface for a screen that exists on
demand is zkde_screencast_unstable_v1. A stream_virtual_output request
creates a real output carrying the requested name, and that output lives
exactly as long as the stream object: KWin removes it when the stream is
closed or its client disconnects, and only then. A failed event is the
PipeWire stream’s failure, not the screen’s — the output is created before
the stream starts — so no PipeWire consumer is required and frames keep
arriving through the host window the nested output opens, which also
drives the screen’s size ([add_screen] only seeds it). Each grown screen
therefore parks one open connection in a process-wide registry; nothing
dispatches it afterwards, because holding the socket open is the entire
contract, and [remove_screen] closes the stream to give the screen back.
A session is offered a second display on this rung when the compositor
serves the request ([screen_control_offered], a registry read that
touches no screen); whether it registers the screen it grows is proven
when a display asks for one, since a KWin whose nested backend registers
no virtual output serves the request all the same: [grow] confirms the
screen against the output devices and refuses the display with that
reason.
Arrangement rides kde_output_management_v2 over the per-output
kde_output_device_v2 globals. Unlike zwlr_output_management_v1 there
is no state serial and a configuration is a delta — a device left out
keeps its state — and modes come from the advertised list only, never
custom, so [set_screen_layout] positions screens and leaves their size
to the capture side; their scale is not set here either, because a nested
KWin accepts one and ignores it, following the host window’s preferred
fractional scale instead. Screens are addressed by position in name order,
matching outclient. Blocking, off the compositor thread, with every
round-trip deadline-bounded.
Structs§
- Cast
State 🔒 - Device 🔒
- One
kde_output_device_v2global with the state its events carried. - Held
Screen 🔒 - A grown screen’s keep-alive: the connection whose lifetime is the screen’s.
- KdeOut
State 🔒
Enums§
- Grow
Error 🔒 - Why a screen could not be grown: the compositor was unreachable, or it answered and refused. A probe reports the first and answers “no” to the second.
Constants§
- POINTER_
HIDDEN 🔒 zkde_screencast_unstable_v1.pointervalue asking for no cursor in the stream nobody consumes.
Functions§
- add_
screen - Grow a screen named
nameon the compositor atsocket_path, holding it open untilremove_screen. Idempotent for a name already held. - apply_
configuration 🔒 - Apply a configuration and wait, deadline-bounded, for the compositor’s verdict on it; the configuration object is released either way.
- connect 🔒
- Connect to the compositor at
socket_pathand read its registry, which binds the screencast manager when one is served at the version carryingstream_virtual_output. - enabled_
sorted 🔒 - Indices of the enabled devices in name order — the order screens map to
displays, matching
outclient’s addressing. - grow 🔒
- Grow a screen named
nameon the compositor atsocket_pathand return its keep-alive; the screen lives until that is dropped or its stream closed. - held_
screens 🔒 - Held screens by the name they were grown under, process-wide: the FFI layer is stateless per call, and a screen must outlive the call that grew it.
- list_
screens - The session’s enabled screens as
(name, x, y, width, height)in screen order; the size is the current mode’s,(0, 0)where none was announced. Empty when the compositor serves nokde_output_device_v2globals. - read_
devices 🔒 - Connect to
socket_pathand read the output-device globals to a settled state: one round-trip announces them, a second delivers their events. - remove_
screen - Close the held stream behind the screen
name, removing it — the compositor’s own output-destroy path evacuates its windows. False when no such screen is held (one the session booted with, or another process’s). - screen_
control_ offered - Whether the compositor on
socket_pathserveszkde_screencast_unstable_v1at the version carryingstream_virtual_output: the rung a session with no control socket is offered a second display on. A registry read alone, so a session is asked on every landing without a screen coming or going on it; whether a grown screen registers isgrow’s to prove. Err only when the compositor is unreachable. - screen_
present 🔒 - Whether an enabled screen named
nameis among the compositor’s output devices. - set_
screen_ layout - Position the session’s screens at
rects, one(x, y, width, height)per screen in screen order; sizes are validated but not applied, because a nested KWin screen’s size follows its host window. The rectangles are capture pixels and the positions land in the session’s logical space, closed up around each screen’s scale (outclient::close_gaps). Returns how many were positioned; 0 when the compositor serves nokde_output_management_v2.