pub struct Client { /* private fields */ }Expand description
A Wayland client that enumerates capturable toplevels and outputs and drives
their capture sessions over ext-image-copy-capture.
Implementations§
Source§impl Client
impl Client
Sourcepub fn connect() -> Result<Self>
pub fn connect() -> Result<Self>
Connect, bind the capture managers, and enumerate windows + outputs.
Sourcepub fn refresh(&mut self) -> Result<()>
pub fn refresh(&mut self) -> Result<()>
Drain pending Wayland events (new/closed toplevels, etc.) without blocking on a capture, so the source list stays current between capture rounds.
Sourcepub fn open_toplevel_session(&mut self, t: &Toplevel) -> Result<SessionId>
pub fn open_toplevel_session(&mut self, t: &Toplevel) -> Result<SessionId>
Open a persistent capture session for a window. The session and its buffer
live until Client::close_session (or the source disappears); re-arm a
frame each cycle with [Client::capture].
Sourcepub fn open_output_session(&mut self, o: &Output) -> Result<SessionId>
pub fn open_output_session(&mut self, o: &Output) -> Result<SessionId>
Open a persistent capture session for an output. See Client::open_toplevel_session.
Sourcepub fn close_session(&mut self, id: &SessionId)
pub fn close_session(&mut self, id: &SessionId)
Tear down a session (e.g. its window closed).
Sourcepub fn capture_output_once(
&mut self,
output: &Output,
budget: Duration,
) -> Result<Frame>
pub fn capture_output_once( &mut self, output: &Output, budget: Duration, ) -> Result<Frame>
One-shot: capture a single frame of output, then tear the session down.
Blocks up to budget. For screenshots / timelapse ticks.
Sourcepub fn capture_toplevel_once(
&mut self,
toplevel: &Toplevel,
budget: Duration,
) -> Result<Frame>
pub fn capture_toplevel_once( &mut self, toplevel: &Toplevel, budget: Duration, ) -> Result<Frame>
One-shot: capture a single frame of toplevel, then tear the session down.
Sourcepub fn poll(
&mut self,
budget: Duration,
) -> (Vec<(SessionId, Frame)>, Vec<SessionId>)
pub fn poll( &mut self, budget: Duration, ) -> (Vec<(SessionId, Frame)>, Vec<SessionId>)
Drive all open sessions for up to budget: arm a frame on every idle
session, wait for events, and return the frames that became ready (the
sources that produced new content). Sessions whose source is static simply
keep their frame armed and deliver nothing — which is exactly right, there
is nothing new to show.
Also returns the ids of sessions the compositor stopped (e.g. their window closed), so the caller can drop and (if still listed) reopen them.
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !Send for Client
impl !Sync for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.