more debugging help

This commit is contained in:
bunnie 2022-11-09 00:33:01 +08:00
parent 1129f1c3c6
commit 4c45dfa6bf
2 changed files with 17 additions and 0 deletions

View file

@ -364,6 +364,7 @@ impl ContextManager {
} else if // app covering an app
(context.layout.behavior() == LayoutBehavior::App) &&
(leaving_focused_context.layout.behavior() == LayoutBehavior::App) {
log::debug!("resolved: app covering app");
context.layout.set_visibility_state(true, canvases);
leaving_visibility = false;
self.context_stack.pop();
@ -371,16 +372,25 @@ impl ContextManager {
} else if // alert covering an app
(context.layout.behavior() == LayoutBehavior::Alert) &&
(leaving_focused_context.layout.behavior() == LayoutBehavior::App) {
log::debug!("resolved: alert covering app");
context.layout.set_visibility_state(true, canvases);
leaving_visibility = true;
self.context_stack.push(token);
} else if // app covering an alert
(context.layout.behavior() == LayoutBehavior::App) &&
(leaving_focused_context.layout.behavior() == LayoutBehavior::Alert) {
log::debug!("resolved: app covering alert");
context.layout.set_visibility_state(true, canvases);
leaving_visibility = false;
self.context_stack.pop();
}
} else {
log::warn!("resolved: staying in same context. This is not an expected case.");
// this path "shouldn't" happen because the discipline is that every pop-up must
// return control back to the main thread (you can't chain pop-ups).
// thus, kick out a warning if this happens, but also, try to do something reasonable.
self.redraw().expect("couldn't redraw the currently focused app");
return Ok(());
}
} else {
// there was no current focus, just make the activation visible

View file

@ -156,6 +156,7 @@ fn wrapped_main() -> ! {
let mut work_queue = Vec::<(xous::MessageSender, [u32; 4])>::new();
let mut dynamic_notification_listener: Option<xous::MessageSender> = None;
let mut dynamic_notification_active: bool = false;
loop {
let mut msg = xous::receive_message(modals_sid).unwrap();
@ -660,6 +661,10 @@ fn wrapped_main() -> ! {
renderer_modal.activate();
}
RendererState::RunDynamicNotification(config) => {
if dynamic_notification_active {
log::error!("Dynamic notification already active! Double-calls lead to unpredictable results");
}
dynamic_notification_active = true;
let mut top_text = String::new();
if let Some(title) = config.title {
#[cfg(feature = "tts")]
@ -687,6 +692,7 @@ fn wrapped_main() -> ! {
Some(DEFAULT_STYLE),
);
renderer_modal.activate();
xous::yield_slice();
}
RendererState::None => {
log::error!(
@ -744,6 +750,7 @@ fn wrapped_main() -> ! {
},
Some(Opcode::DoCloseDynamicNotification) => {
renderer_modal.gam.relinquish_focus().unwrap();
dynamic_notification_active = false;
op = RendererState::None;
if let Some(sender) = dynamic_notification_listener.take() {
// unblock the listener with no key hit response