Skip to main content

WKB

Struct WKB 

Source
pub struct WKB<C: Composer> { /* private fields */ }
Expand description

Core keyboard state machine. Tracks modifier state, key presses, and compose sequences.

C is the compose backend — typically [ListComposer] when using the xkb feature.

Implementations§

Source§

impl WKB<ListComposer>

Source

pub fn new_from_names(locale: String, layout: Option<String>) -> Self

Create WKB instance from RMLVO names (Rules, Model, Layout, Variant, Options)

Source

pub fn new_from_string(string: String) -> Self

Create WKB instance from XKB keymap string

Source§

impl<C: Composer> WKB<C>

Source

pub fn reset_state(&mut self)

Reset all transient input state: compose sequence and pressed keys. Call on wl_keyboard.leave or when focus changes.

Source

pub fn modifiers_state(&self) -> (u32, u32, u32, u32)

Return the current modifier state as (depressed, latched, locked, group) bitmasks.

Source

pub fn leds_state(&self) -> u32

Return the LED indicator state as a bitmask (bit 0 = NumLock, bit 1 = CapsLock, bit 2 = ScrollLock).

Source

pub fn update_modifiers( &mut self, depressed: u32, latched: u32, locked: u32, group: u32, )

Apply modifier state received from wl_keyboard.modifiers. Updates depressed, latched, locked masks and active layout group.

Source

pub fn level_key(&self, evdev_code: u32, level_index: usize) -> Option<char>

Look up the character at a specific shift level for the given evdev keycode.

Source

pub fn num_levels(&self) -> usize

Return the number of shift levels supported by this keymap.

Source

pub fn key_repeats(&self, evdev_code: u32) -> bool

Return whether the given evdev keycode is a repeating key.

Source

pub fn utf8(&mut self, evdev_code: u32) -> Option<char>

Resolve the character for the given evdev keycode under the current modifier state.

Source

pub fn key( &mut self, evdev_code: u32, key_direction: KeyDirection, ) -> (Option<char>, bool)

Process a key event: update state and return (character, is_modifier).

Source

pub fn key_compose( &mut self, evdev_code: u32, key_direction: KeyDirection, ) -> (Option<ComposeState>, bool)

Process a key event with compose support. Returns (compose_state, is_modifier).

Source

pub fn layouts(&self) -> Vec<String>

Return the list of layout names available in this keymap.

Source

pub fn current_layout(&self) -> String

Return the name of the currently active layout.

Source

pub fn as_xkb_string(&self) -> Option<String>

Serialize the underlying XKB keymap to v1 text format.

Returns None if the instance was not built from an XKB keymap.

Trait Implementations§

Source§

impl<C: Clone + Composer> Clone for WKB<C>

Source§

fn clone(&self) -> WKB<C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug + Composer> Debug for WKB<C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for WKB<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for WKB<C>
where C: RefUnwindSafe,

§

impl<C> !Send for WKB<C>

§

impl<C> !Sync for WKB<C>

§

impl<C> Unpin for WKB<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for WKB<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for WKB<C>
where C: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.