Skip to main content

Module kdeclient

Module kdeclient 

Source
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§

CastState 🔒
Device 🔒
One kde_output_device_v2 global with the state its events carried.
HeldScreen 🔒
A grown screen’s keep-alive: the connection whose lifetime is the screen’s.
KdeOutState 🔒

Enums§

GrowError 🔒
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.pointer value asking for no cursor in the stream nobody consumes.

Functions§

add_screen
Grow a screen named name on the compositor at socket_path, holding it open until remove_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_path and read its registry, which binds the screencast manager when one is served at the version carrying stream_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 name on the compositor at socket_path and 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 no kde_output_device_v2 globals.
read_devices 🔒
Connect to socket_path and 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_path serves zkde_screencast_unstable_v1 at the version carrying stream_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 is grow’s to prove. Err only when the compositor is unreachable.
screen_present 🔒
Whether an enabled screen named name is 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 no kde_output_management_v2.