Skip to content

Commit

Permalink
more debugging help
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie committed Nov 8, 2022
1 parent 1129f1c commit 4c45dfa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/gam/src/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,23 +364,33 @@ 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();
self.context_stack.push(token);
} 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
Expand Down
7 changes: 7 additions & 0 deletions services/modals/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -687,6 +692,7 @@ fn wrapped_main() -> ! {
Some(DEFAULT_STYLE),
);
renderer_modal.activate();
xous::yield_slice();
}
RendererState::None => {
log::error!(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4c45dfa

Please sign in to comment.