[go: up one dir, main page]

Seat

Struct Seat 

Source
pub struct Seat { /* private fields */ }

Implementations§

Source§

impl Seat

Source

pub fn open<C>(callback: C) -> Result<Self, Errno>
where C: FnMut(&mut SeatRef, SeatEvent) + 'static,

Opens a seat, taking control of it if possible and returning a pointer to the libseat instance. If LIBSEAT_BACKEND is set, the specified backend is used. Otherwise, the first successful backend will be used.

Methods from Deref<Target = SeatRef>§

Source

pub fn disable(&mut self) -> Result<(), Errno>

Disables a seat, used in response to a disable_seat event. After disabling the seat, the seat devices must not be used until enable_seat is received, and all requests on the seat will fail during this period.

Source

pub fn open_device<P: AsRef<Path>>(&mut self, path: &P) -> Result<Device, Errno>

Opens a device on the seat, returning its device ID and fd

This will only succeed if the seat is active and the device is of a type permitted for opening on the backend, such as drm and evdev.

The device may be revoked in some situations, such as in situations where a seat session switch is being forced.

Source

pub fn close_device(&mut self, device: Device) -> Result<(), Errno>

Closes a device that has been opened on the seat using the device_id from libseat_open_device.

Source

pub fn name(&mut self) -> &str

Retrieves the name of the seat that is currently made available through the provided libseat instance.

Source

pub fn switch_session(&mut self, session: i32) -> Result<(), Errno>

Requests that the seat switches session to the specified session number. For seats that are VT-bound, the session number matches the VT number, and switching session results in a VT switch.

A call to libseat_switch_session does not imply that a switch will occur, and the caller should assume that the session continues unaffected.

Source

pub fn get_fd(&mut self) -> Result<BorrowedFd<'_>, Errno>

Retrieve the pollable connection fd for a given libseat instance. Used to poll the libseat connection for events that need to be dispatched.

Returns a pollable fd on success.

Source

pub fn dispatch(&mut self, timeout: i32) -> Result<i32, Errno>

Reads and dispatches events on the libseat connection fd.

The specified timeout dictates how long libseat might wait for data if none is available: 0 means that no wait will occur, -1 means that libseat might wait indefinitely for data to arrive, while > 0 is the maximum wait in milliseconds that might occur.

Returns a positive number signifying processed internal messages on success. Returns 0 if no messages were processed. Returns -1 and sets errno on error.

Trait Implementations§

Source§

impl Debug for Seat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Seat

Source§

type Target = SeatRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Seat

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for Seat

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Seat

§

impl !RefUnwindSafe for Seat

§

impl !Send for Seat

§

impl !Sync for Seat

§

impl Unpin for Seat

§

impl !UnwindSafe for Seat

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.