mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
improve dynamic notifications / kbhit reporting
This commit is contained in:
parent
ffd8e3607d
commit
ebd4e7a1ba
2 changed files with 26 additions and 26 deletions
|
|
@ -164,26 +164,25 @@ impl ActionApi for Notification {
|
|||
if self.qrwidth > 0 {
|
||||
self.draw_qrcode(at_height, modal);
|
||||
}
|
||||
|
||||
// divider lines
|
||||
let color = if self.is_password {
|
||||
PixelColor::Light
|
||||
} else {
|
||||
PixelColor::Dark
|
||||
};
|
||||
|
||||
modal
|
||||
.gam
|
||||
.draw_line(
|
||||
modal.canvas,
|
||||
Line::new_with_style(
|
||||
Point::new(modal.margin, at_height + modal.margin),
|
||||
Point::new(modal.canvas_width - modal.margin, at_height + modal.margin),
|
||||
DrawStyle::new(color, color, 1),
|
||||
),
|
||||
)
|
||||
.expect("couldn't draw entry line");
|
||||
}
|
||||
// divider lines
|
||||
let color = if self.is_password {
|
||||
PixelColor::Light
|
||||
} else {
|
||||
PixelColor::Dark
|
||||
};
|
||||
|
||||
modal
|
||||
.gam
|
||||
.draw_line(
|
||||
modal.canvas,
|
||||
Line::new_with_style(
|
||||
Point::new(modal.margin, at_height + modal.margin),
|
||||
Point::new(modal.canvas_width - modal.margin, at_height + modal.margin),
|
||||
DrawStyle::new(color, color, 1),
|
||||
),
|
||||
)
|
||||
.expect("couldn't draw entry line");
|
||||
}
|
||||
fn key_action(&mut self, k: char) -> (Option<ValidatorErr>, bool) {
|
||||
log::trace!("key_action: {}", k);
|
||||
|
|
@ -192,12 +191,12 @@ impl ActionApi for Notification {
|
|||
// ignore null messages
|
||||
}
|
||||
_ => {
|
||||
send_message(
|
||||
self.action_conn,
|
||||
xous::Message::new_scalar(self.action_opcode as usize, k as u32 as usize, 0, 0, 0),
|
||||
)
|
||||
.expect("couldn't pass on dismissal");
|
||||
if self.manual_dismiss {
|
||||
send_message(
|
||||
self.action_conn,
|
||||
xous::Message::new_scalar(self.action_opcode as usize, k as u32 as usize, 0, 0, 0),
|
||||
)
|
||||
.expect("couldn't pass on dismissal");
|
||||
return (None, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ fn main() -> ! {
|
|||
renderer_cid,
|
||||
Opcode::HandleDynamicNotificationKeyhit.to_u32().unwrap(),
|
||||
);
|
||||
gutter.set_manual_dismiss(true);
|
||||
gutter.set_manual_dismiss(false);
|
||||
renderer_modal.modify(
|
||||
Some(ActionType::Notification(gutter)),
|
||||
Some(&top_text),
|
||||
|
|
@ -587,6 +587,7 @@ fn main() -> ! {
|
|||
None,
|
||||
);
|
||||
renderer_modal.redraw();
|
||||
xous::yield_slice();
|
||||
}
|
||||
_ => {
|
||||
log::error!("UX return opcode does not match our current operation in flight. This is a serious internal error.");
|
||||
|
|
@ -599,7 +600,7 @@ fn main() -> ! {
|
|||
token_lock = next_lock(&mut work_queue);
|
||||
},
|
||||
Some(Opcode::HandleDynamicNotificationKeyhit) => msg_scalar_unpack!(msg, k, _, _, _, {
|
||||
log::info!("Dynamic kbd hit: {}({})", k, char::from_u32(k as u32).unwrap_or(' '));
|
||||
log::debug!("Dynamic kbd hit: {}({})", k, char::from_u32(k as u32).unwrap_or(' '));
|
||||
if let Some(sender) = dynamic_notification_listener.take() {
|
||||
xous::return_scalar2(sender, 1, k).unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue