Skip to main content

HostSession

Struct HostSession 

Source
pub struct HostSession { /* private fields */ }
Expand description

The calloop-side session: input proxies plus one capture handle per output.

Implementations§

Source§

impl HostSession

Source

pub fn connect(display: &str, gbm_path: Option<PathBuf>) -> Result<Self, String>

Connect to display, bring up input devices, enumerate the host’s outputs and spawn one capture thread per output (idle until [start_capture]) plus the layout-control thread. gbm_path (this process’s render node) enables the zero-copy path.

Source

pub fn output_count(&self) -> usize

Source

pub fn has_output_for(&self, display_id: u32) -> bool

True when an active capture on display_id has a host output behind it.

Source

pub fn set_layout(&self, display_id: u32, x: i32, y: i32)

Record where selkies laid out display_id (union coordinates); pushed to the host with the next capture (re)start.

Source

pub fn current_output_size(&self, display_id: u32) -> Option<(i32, i32)>

The current mode of the host output backing display_id (physical pixels), as the host last announced it — what a capture follows when the host keeps its own mode instead of taking the requested one.

Source

pub fn layout_outcome(&self, epoch: u64) -> Option<bool>

The host’s verdict on the layout request epoch (as returned by [start_capture]): Some(true) once the host applied it, Some(false) once it kept its own modes (refusal, no layout management at all — KWin — or no answer within LAYOUT_DEADLINE), None while still unanswered. Never blocks; the caller polls it from its own loop and, on Some(false), compares [current_output_size] with what it asked for.

Source

pub fn start_capture( &self, display_id: u32, width: i32, height: i32, zero_copy: bool, paint_cursor: bool, ) -> u64

Aim display_id at widthxheight: assigns every active display its host output (by rank), asks the host for all modes and positions in one atomic configuration, and points the capture threads at their sizes and buffer types; frames gate until the host applies them. zero_copy states whether this display’s encoder imports dmabufs — a CPU consumer needs shm frames it can read, and gets them even on a GPU-capable host. Returns the layout request’s epoch for [layout_outcome]; nothing here waits on the host.

Source

pub fn set_buffer_type(&self, display_id: u32, zero_copy: bool)

Point display_id’s capture at dmabufs (zero_copy) or shm frames without touching its mode or position, which is what an encoder demoted or rebuilt mid-capture needs: the layout is already what the host applied, and re-running it would mode-set the host display again. Idempotent, so a consumer that keeps seeing the wrong buffer type until the capture thread reallocates can call this on every frame.

Source

pub fn set_cursor_painting(&self, paint_cursor: bool)

Switch every active capture between host-painted and consumer-drawn cursors (the consumer’s native cursor rendering toggle), keeping geometry and buffer type. Frames already buffered stay valid either way. Idempotent.

Source

pub fn idle_output(&self, display_id: u32)

Park display_id’s capture (its slot leaves the pointer extent). The retained frame and anything still queued go back to the capture pool — an idle output has no consumer for them, and dropping them silently would wedge slots until the next renegotiation.

Source

pub fn alive(&self) -> bool

False once the host connection is gone (the primary connection or the first output’s capture ended): the owner drops the session and reports its captures as stopped, so they are rebuilt against a new connection instead of feeding a dead one.

Source

pub fn release_frame(&self, display_id: u32, frame: HostFrame)

Hand one frame back to the pool (same path the drain/idle releases take).

Source

pub fn try_take_frame(&self, display_id: u32) -> Option<HostFrame>

Newest ready frame for display_id, releasing any staler ones straight back to the pool.

Source

pub fn retain_frame(&self, display_id: u32, frame: HostFrame)

Keep frame as display_id’s current content (releasing the one it replaces).

Source

pub fn with_retained<R>( &self, display_id: u32, f: impl FnOnce(Option<&HostFrame>) -> R, ) -> R

Run f with display_id’s retained (current-content) frame, if any.

Source

pub fn set_keymap(&self, text: &str)

Upload selkies’ managed keymap to the virtual keyboard verbatim.

Source

pub fn key(&self, xkb_keycode: u32, pressed: bool)

Key event in xkb numbering (evdev + 8), matching the seat injectors.

Source

pub fn pointer_motion_abs(&self, x: f64, y: f64)

Source

pub fn pointer_motion_rel(&self, dx: f64, dy: f64)

Relative motion in union-layout units, sent as the host’s own relative motion: the host moves its pointer by the delta and clamps it to its outputs, or, for a pointer-locked client, passes the delta on without moving it. An absolute warp against a position tracked here could not do the second: the locked host pointer stays put, so every warp would read as the whole distance from the lock point.

Source

pub fn pointer_button(&self, btn: u32, pressed: bool)

Source

pub fn pointer_axis(&self, dx: f64, dy: f64)

Wheel scroll: the continuous value plus the discrete step count the seat path reports as v120, so host clients that scroll by notches (terminals, games, GTK list views) see the same steps as in nested mode; a value below one notch stays continuous. The source follows each axis request, which is the axis it applies to on wlroots.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more