-1 on unrecognized input and start bitmap converter

This commit is contained in:
Mwa
2026-03-17 13:22:33 +01:00
parent 30a7d1c5e4
commit 20f7c289ed
5 changed files with 798 additions and 23 deletions

View File

@@ -93,20 +93,21 @@ impl<'a> ApplicationHandler for App<'a> {
print!("Keyboard event: ");
#[cfg(feature = "rich_keyboard")]
{
let kb0 = key_event
.text_with_all_modifiers()
.unwrap_or("")
.as_bytes()
.into_iter()
.fold(0, |a, e| a << 8 | (*e as u32));
let kb0 = key_event.text_with_all_modifiers().map_or(u32::MAX, |s| {
s.as_bytes()
.into_iter()
.fold(0, |a, e| a << 8 | (*e as u32))
});
SHARED.keyboard[0].store(kb0, Relaxed);
let kb1 = key_event
.key_without_modifiers()
.to_text()
.unwrap_or("")
.as_bytes()
.into_iter()
.fold(0, |a, e| a << 8 | (*e as u32));
.map_or(u32::MAX, |s| {
s.as_bytes()
.into_iter()
.fold(0, |a, e| a << 8 | (*e as u32))
});
SHARED.keyboard[1].store(kb1, Relaxed);
let kb2 =
key_event.state.is_pressed() as u32 | ((key_event.repeat as u32) << 1);