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
This commit is contained in:
bunnie 2025-05-06 01:47:55 +08:00
parent 3faad803d3
commit 30fcc3016f
2 changed files with 10 additions and 1 deletions

View file

@ -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 = []

View file

@ -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::<Sender>::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