mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
drop fat-fingered inputs after menu or dialog box close
This commit is contained in:
parent
830d875911
commit
c07101f41c
3 changed files with 10 additions and 40 deletions
|
|
@ -452,26 +452,10 @@ fn xmain() -> ! {
|
|||
},
|
||||
Some(Opcode::KeyboardEvent) => msg_scalar_unpack!(msg, k1, k2, k3, k4, {
|
||||
let keys = [
|
||||
if let Some(a) = core::char::from_u32(k1 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k2 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k3 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k4 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
core::char::from_u32(k1 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k2 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k3 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k4 as u32).unwrap_or('\u{0000}'),
|
||||
];
|
||||
context_mgr.key_event(keys, &gfx, &mut canvases);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ impl<'a> Menu<'a> {
|
|||
}
|
||||
self.index = 0; // reset the index to 0
|
||||
self.gam.redraw().unwrap();
|
||||
break; // drop any characters that happened to trail the select key, it's probably a fat-finger error.
|
||||
},
|
||||
'←' => {
|
||||
// placeholder
|
||||
|
|
@ -414,26 +415,10 @@ pub fn menu_matic(items: Vec::<MenuItem>, menu_name: &'static str, maybe_manager
|
|||
},
|
||||
Some(MenuOpcode::Rawkeys) => xous::msg_scalar_unpack!(msg, k1, k2, k3, k4, {
|
||||
let keys = [
|
||||
if let Some(a) = core::char::from_u32(k1 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k2 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k3 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
if let Some(a) = core::char::from_u32(k4 as u32) {
|
||||
a
|
||||
} else {
|
||||
'\u{0000}'
|
||||
},
|
||||
core::char::from_u32(k1 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k2 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k3 as u32).unwrap_or('\u{0000}'),
|
||||
core::char::from_u32(k4 as u32).unwrap_or('\u{0000}'),
|
||||
];
|
||||
menu.lock().unwrap().key_event(keys);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -436,6 +436,7 @@ impl<'a> Modal<'a> {
|
|||
log::debug!("closing modal");
|
||||
// if it's a "close" button, invoke the GAM to put our box away
|
||||
self.gam.relinquish_focus().unwrap();
|
||||
break; // don't process any more keys after a close message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue