pub enum PointerButton {
Left,
Middle,
Right,
Other(u32),
}Expand description
Pointer button.
The three named variants cover every standard mouse; Other(code)
is an escape hatch for everything else (back/forward, gaming-mouse
extras, side buttons) carrying the Linux BTN_* evdev code as a
raw u32. A typed enum at the trait boundary catches obvious
bugs (passing a literal 0x110 everywhere instead of BTN_LEFT)
at compile time and lets non-evdev backends translate centrally
in their own evdev_code consumer.
Variants§
Left
Primary mouse button (BTN_LEFT, 0x110).
Middle
Wheel-press button (BTN_MIDDLE, 0x112).
Right
Secondary / context-menu button (BTN_RIGHT, 0x111).
Other(u32)
Any other button, identified by its Linux evdev BTN_* code.
Backends that use a different transport are expected to
translate; callers that already have an evdev code in hand
(e.g. parsed from external input) can pass it straight through.
Implementations§
Source§impl PointerButton
impl PointerButton
Sourcepub fn evdev_code(self) -> u32
pub fn evdev_code(self) -> u32
Return the Linux evdev BTN_* code for this button. Used by
backends whose transport speaks evdev directly (mutter’s
RemoteDesktop, libei). Backends on other transports translate
in their own pattern-match.
Sourcepub fn from_evdev_code(code: u32) -> Self
pub fn from_evdev_code(code: u32) -> Self
Construct from a Linux evdev BTN_* code, mapping the three
standard buttons onto their named variants and falling back to
Other(code) for anything else. This is the boundary
inverse of evdev_code and is what
callers receiving raw codes (MCP JSON, libinput pass-through)
should use.
Trait Implementations§
Source§impl Clone for PointerButton
impl Clone for PointerButton
Source§fn clone(&self) -> PointerButton
fn clone(&self) -> PointerButton
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PointerButton
impl Debug for PointerButton
Source§impl PartialEq for PointerButton
impl PartialEq for PointerButton
impl Copy for PointerButton
impl Eq for PointerButton
impl StructuralPartialEq for PointerButton
Auto Trait Implementations§
impl Freeze for PointerButton
impl RefUnwindSafe for PointerButton
impl Send for PointerButton
impl Sync for PointerButton
impl Unpin for PointerButton
impl UnsafeUnpin for PointerButton
impl UnwindSafe for PointerButton
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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