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>
impl WKB<ListComposer>
Sourcepub fn new_from_names(locale: String, layout: Option<String>) -> Self
pub fn new_from_names(locale: String, layout: Option<String>) -> Self
Create WKB instance from RMLVO names (Rules, Model, Layout, Variant, Options)
Sourcepub fn new_from_string(string: String) -> Self
pub fn new_from_string(string: String) -> Self
Create WKB instance from XKB keymap string
Source§impl<C: Composer> WKB<C>
impl<C: Composer> WKB<C>
Sourcepub fn reset_state(&mut self)
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.
Sourcepub fn modifiers_state(&self) -> (u32, u32, u32, u32)
pub fn modifiers_state(&self) -> (u32, u32, u32, u32)
Return the current modifier state as (depressed, latched, locked, group) bitmasks.
Sourcepub fn leds_state(&self) -> u32
pub fn leds_state(&self) -> u32
Return the LED indicator state as a bitmask (bit 0 = NumLock, bit 1 = CapsLock, bit 2 = ScrollLock).
Sourcepub fn update_modifiers(
&mut self,
depressed: u32,
latched: u32,
locked: u32,
group: u32,
)
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.
Sourcepub fn level_key(&self, evdev_code: u32, level_index: usize) -> Option<char>
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.
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
Return the number of shift levels supported by this keymap.
Sourcepub fn key_repeats(&self, evdev_code: u32) -> bool
pub fn key_repeats(&self, evdev_code: u32) -> bool
Return whether the given evdev keycode is a repeating key.
Sourcepub fn utf8(&mut self, evdev_code: u32) -> Option<char>
pub fn utf8(&mut self, evdev_code: u32) -> Option<char>
Resolve the character for the given evdev keycode under the current modifier state.
Sourcepub fn key(
&mut self,
evdev_code: u32,
key_direction: KeyDirection,
) -> (Option<char>, bool)
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).
Sourcepub fn key_compose(
&mut self,
evdev_code: u32,
key_direction: KeyDirection,
) -> (Option<ComposeState>, bool)
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).
Sourcepub fn current_layout(&self) -> String
pub fn current_layout(&self) -> String
Return the name of the currently active layout.
Sourcepub fn as_xkb_string(&self) -> Option<String>
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.