-1 on unrecognized input and start bitmap converter
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user