pub struct Seat { /* private fields */ }
Implementations
sourceimpl Seat
impl Seat
sourcepub fn open<C, L>(callback: C, _logger: L) -> Result<Self, Errno>where
C: FnMut(&mut SeatRef, SeatEvent) + 'static,
L: Into<Option<Logger>>,
pub fn open<C, L>(callback: C, _logger: L) -> Result<Self, Errno>where
C: FnMut(&mut SeatRef, SeatEvent) + 'static,
L: Into<Option<Logger>>,
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>
sourcepub fn disable(&mut self) -> Result<(), Errno>
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.
sourcepub fn open_device<P: AsRef<Path>>(
&mut self,
path: &P
) -> Result<(i32, RawFd), Errno>
pub fn open_device<P: AsRef<Path>>(
&mut self,
path: &P
) -> Result<(i32, RawFd), 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.
sourcepub fn close_device(&mut self, device_id: i32) -> Result<(), Errno>
pub fn close_device(&mut self, device_id: i32) -> Result<(), Errno>
Closes a device that has been opened on the seat using the device_id from libseat_open_device.
sourcepub fn name(&mut self) -> &str
pub fn name(&mut self) -> &str
Retrieves the name of the seat that is currently made available through the provided libseat instance.
sourcepub fn switch_session(&mut self, session: i32) -> Result<(), Errno>
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.
sourcepub fn get_fd(&mut self) -> Result<RawFd, Errno>
pub fn get_fd(&mut self) -> Result<RawFd, 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.
sourcepub fn dispatch(&mut self, timeout: i32) -> Result<i32, Errno>
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
Auto Trait Implementations
impl !RefUnwindSafe for Seat
impl !Send for Seat
impl !Sync for Seat
impl Unpin for Seat
impl !UnwindSafe for Seat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more