From ce8c7f51c3d929365e4bc5e3c10e883127a13813 Mon Sep 17 00:00:00 2001 From: nworbnhoj Date: Thu, 7 Sep 2023 11:10:23 +1000 Subject: [PATCH] gam forward ALL rawkeys to the current context even when IMEF active Forwarding of rawkeys to upper layers is important to enable apps to layer additional functionality on top of base. --- services/gam/src/contexts.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/services/gam/src/contexts.rs b/services/gam/src/contexts.rs index 02022669c..640d0d311 100644 --- a/services/gam/src/contexts.rs +++ b/services/gam/src/contexts.rs @@ -161,7 +161,7 @@ impl ContextManager { gotinput_id: registration.gotinput_id, audioframe_id: registration.audioframe_id, focuschange_id: registration.focuschange_id, - rawkeys_id: None, + rawkeys_id: registration.rawkeys_id, vibe: false, imef_menu_mode: false, // this gets initialized on the first attempt to change predictors, not here @@ -631,21 +631,21 @@ impl ContextManager { if self.imef_active { // use the IMEF self.imef.send_keyevent(keys).expect("couldn't send keys to the IMEF"); - } else { - // forward the keyboard hits without any IME to the current context - log::debug!("forwarding raw key event"); - if let Some(context) = self.focused_context() { - if let Some(rawkeys_id) = context.rawkeys_id { - xous::send_message(context.listener, - xous::Message::new_scalar(rawkeys_id as usize, - keys[0] as u32 as usize, - keys[1] as u32 as usize, - keys[2] as u32 as usize, - keys[3] as u32 as usize, - )).expect("couldn't forward raw keys onto context listener"); - } - } } + + // forward the keyboard hits to the current context + log::debug!("forwarding raw key event"); + if let Some(context) = self.focused_context() { + if let Some(rawkeys_id) = context.rawkeys_id { + xous::send_message(context.listener, + xous::Message::new_scalar(rawkeys_id as usize, + keys[0] as u32 as usize, + keys[1] as u32 as usize, + keys[2] as u32 as usize, + keys[3] as u32 as usize, + )).expect("couldn't forward raw keys onto context listener"); + } + } } fn focused_context(&'_ self) -> Option<&'_ UxContext> {