From 30fcc3016f095bd45f57a70fc20445ffb94852ab Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 6 May 2025 01:47:55 +0800 Subject: [PATCH] use bao-video to route the acquire/release of the modals focus it has to route through here anyways, so this is the sensible place to also forward on the keyboard release/acquire messages --- services/bao-video/Cargo.toml | 5 ++++- services/bao-video/src/main.rs | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/bao-video/Cargo.toml b/services/bao-video/Cargo.toml index bfd9f7aa5..85e0d1708 100644 --- a/services/bao-video/Cargo.toml +++ b/services/bao-video/Cargo.toml @@ -25,6 +25,7 @@ rkyv = { version = "0.8.8", default-features = false, features = [ "std", "alloc", ] } +modals = { path = "../modals", optional = true } # QR decoding libm = { version = "0.2.8" } @@ -34,6 +35,7 @@ rqrr = "0.8.0" locales = { path = "../../locales" } [features] +no-gam = ["modals/no-gam"] gfx-testing = [] ditherpunk = [] @@ -45,8 +47,9 @@ board-baosec = [ "cramium-hal", "ux-api/board-baosec", "blitstr2/board-baosec", + "no-gam", ] -hosted-baosec = ["cramium-emu", "ux-api/hosted-baosec"] +hosted-baosec = ["cramium-emu", "ux-api/hosted-baosec", "no-gam"] # temporary feature - remove after we have properly created a camera control API autotest = [] diff --git a/services/bao-video/src/main.rs b/services/bao-video/src/main.rs index 2c385f84c..0ea219eeb 100644 --- a/services/bao-video/src/main.rs +++ b/services/bao-video/src/main.rs @@ -307,6 +307,8 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { cam.capture_async(); } + #[cfg(feature = "no-gam")] + let modals = modals::Modals::new(&xns).unwrap(); let mut modal_queue = VecDeque::::new(); let mut frames = 0; let mut frame = [0u8; IMAGE_WIDTH * IMAGE_HEIGHT]; @@ -650,6 +652,8 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { // ---- v2 graphics API GfxOpcode::AcquireModal => { if let Some(scalar) = msg.body.scalar_message_mut() { + #[cfg(feature = "no-gam")] + modals.acquire_focus(); // relay this to the modals crate so it knows to ignore key presses let sender = msg.sender; log::debug!("Acquirer Sender: {:x?}", sender); modal_queue.push_back(sender); @@ -665,6 +669,8 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { } GfxOpcode::ReleaseModal => { if let Some(_scalar) = msg.body.scalar_message() { + #[cfg(feature = "no-gam")] + modals.release_focus(); // relay this to the modals crate so it knows to ignore key presses let sender = msg.sender; log::debug!("Release Sender: {:x?}", sender); if let Some(pos) = modal_queue