mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +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 {
|
if self.qrwidth > 0 {
|
||||||
self.draw_qrcode(at_height, modal);
|
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) {
|
fn key_action(&mut self, k: char) -> (Option<ValidatorErr>, bool) {
|
||||||
log::trace!("key_action: {}", k);
|
log::trace!("key_action: {}", k);
|
||||||
|
|
@ -192,12 +191,12 @@ impl ActionApi for Notification {
|
||||||
// ignore null messages
|
// 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 {
|
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);
|
return (None, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -536,7 +536,7 @@ fn main() -> ! {
|
||||||
renderer_cid,
|
renderer_cid,
|
||||||
Opcode::HandleDynamicNotificationKeyhit.to_u32().unwrap(),
|
Opcode::HandleDynamicNotificationKeyhit.to_u32().unwrap(),
|
||||||
);
|
);
|
||||||
gutter.set_manual_dismiss(true);
|
gutter.set_manual_dismiss(false);
|
||||||
renderer_modal.modify(
|
renderer_modal.modify(
|
||||||
Some(ActionType::Notification(gutter)),
|
Some(ActionType::Notification(gutter)),
|
||||||
Some(&top_text),
|
Some(&top_text),
|
||||||
|
|
@ -587,6 +587,7 @@ fn main() -> ! {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
renderer_modal.redraw();
|
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.");
|
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);
|
token_lock = next_lock(&mut work_queue);
|
||||||
},
|
},
|
||||||
Some(Opcode::HandleDynamicNotificationKeyhit) => msg_scalar_unpack!(msg, k, _, _, _, {
|
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() {
|
if let Some(sender) = dynamic_notification_listener.take() {
|
||||||
xous::return_scalar2(sender, 1, k).unwrap();
|
xous::return_scalar2(sender, 1, k).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue