diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index 53d50acf0..34ae6cab8 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -354,6 +354,12 @@ impl Gam { 0, 0, 0, 0,) ).map(|_| ()) } + pub fn relinquish_focus_nb(&self) -> Result<(), xous::Error> { + send_message(self.conn, + Message::new_scalar(Opcode::RevertFocusNb.to_usize().unwrap(), + 0, 0, 0, 0,) + ).map(|_| ()) + } pub fn glyph_height_hint(&self, glyph: GlyphStyle) -> Result { let response = send_message(self.conn, diff --git a/services/gam/src/modal.rs b/services/gam/src/modal.rs index a9b63ef10..d765fd453 100644 --- a/services/gam/src/modal.rs +++ b/services/gam/src/modal.rs @@ -472,9 +472,9 @@ impl<'a> Modal<'a> { self.modify(None, None, false, Some(err_msg.to_str()), false, None); } else { if close { - log::debug!("closing modal"); // if it's a "close" button, invoke the GAM to put our box away self.gam.relinquish_focus().unwrap(); + xous::yield_slice(); break; // don't process any more keys after a close message } } diff --git a/services/gam/src/tokens.rs b/services/gam/src/tokens.rs index fd960ed48..ce8f2fde1 100644 --- a/services/gam/src/tokens.rs +++ b/services/gam/src/tokens.rs @@ -82,4 +82,12 @@ impl<'a> TokenManager { None } } + pub(crate) fn lookup_name(&self, token: &[u32; 4]) -> Option { + for entry in self.tokens.iter() { + if entry.token == *token { + return Some(entry.name.to_string()) + } + } + None + } }