mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
strip out excess redraws
This commit is contained in:
parent
5f4678ca6a
commit
b310967cf2
2 changed files with 8 additions and 30 deletions
|
|
@ -169,8 +169,6 @@ fn main() -> ! {
|
|||
// TODO: add a UX loop that indicates we're waiting for a PDDB mount before moving forward
|
||||
let mut vaultux = VaultUx::new(&xns, sid);
|
||||
vaultux.set_mode(VaultMode::Fido);
|
||||
let mut update_vaultux = true;
|
||||
let mut was_callback = false;
|
||||
let mut allow_redraw = false;
|
||||
let modals = modals::Modals::new(&xns).unwrap();
|
||||
loop {
|
||||
|
|
@ -182,8 +180,6 @@ fn main() -> ! {
|
|||
let s = buffer.as_flat::<xous_ipc::String<4000>, _>().unwrap();
|
||||
log::info!("Incremental input: {}", s.as_str());
|
||||
vaultux.input(s.as_str()).expect("Vault couldn't accept input string");
|
||||
update_vaultux = true; // set a flag, instead of calling here, so message can drop and calling server is released
|
||||
was_callback = false;
|
||||
send_message(conn,
|
||||
Message::new_scalar(VaultOp::Redraw.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).ok();
|
||||
|
|
@ -222,8 +218,6 @@ fn main() -> ! {
|
|||
vaultux.raise_menu();
|
||||
}
|
||||
}
|
||||
update_vaultux = true; // set a flag, instead of calling here, so message can drop and calling server is released
|
||||
was_callback = false;
|
||||
send_message(conn,
|
||||
Message::new_scalar(VaultOp::Redraw.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).ok();
|
||||
|
|
@ -243,7 +237,11 @@ fn main() -> ! {
|
|||
allow_redraw = true;
|
||||
}
|
||||
}
|
||||
vaultux.redraw().ok();
|
||||
/*
|
||||
xous::yield_slice();
|
||||
send_message(conn,
|
||||
Message::new_scalar(VaultOp::Redraw.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).ok(); */
|
||||
}),
|
||||
Some(VaultOp::MenuAutotype) => {
|
||||
log::info!("got autotype");
|
||||
|
|
@ -272,16 +270,9 @@ fn main() -> ! {
|
|||
break;
|
||||
}
|
||||
_ => {
|
||||
log::trace!("got unknown message, passing on to REPL");
|
||||
vaultux.msg(msg);
|
||||
update_vaultux = true;
|
||||
was_callback = true;
|
||||
log::trace!("got unknown message {:?}", msg);
|
||||
}
|
||||
}
|
||||
if update_vaultux {
|
||||
vaultux.update(was_callback);
|
||||
update_vaultux = false;
|
||||
}
|
||||
log::trace!("reached bottom of main loop");
|
||||
}
|
||||
// clean up our program
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::*;
|
||||
use gam::{UxRegistration, GlyphStyle};
|
||||
use graphics_server::{Gid, Point, Rectangle, DrawStyle, PixelColor, TextView};
|
||||
use xous::MessageEnvelope;
|
||||
use std::fmt::Write;
|
||||
use pddb::Pddb;
|
||||
use std::cell::RefCell;
|
||||
|
|
@ -45,9 +44,6 @@ pub(crate) enum NavDir {
|
|||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct VaultUx {
|
||||
// messages not handled by the main loop are routed here
|
||||
msg: Option<MessageEnvelope>,
|
||||
|
||||
/// the content area
|
||||
content: Gid,
|
||||
gam: gam::Gam,
|
||||
|
|
@ -171,7 +167,6 @@ impl VaultUx {
|
|||
let items_per_screen = available_height / item_height;
|
||||
|
||||
VaultUx {
|
||||
msg: None,
|
||||
content,
|
||||
gam,
|
||||
screensize,
|
||||
|
|
@ -253,10 +248,6 @@ impl VaultUx {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn msg(&mut self, message: MessageEnvelope) {
|
||||
self.msg = Some(message);
|
||||
}
|
||||
|
||||
fn clear_area(&self) {
|
||||
self.gam.draw_rectangle(self.content,
|
||||
Rectangle::new_with_style(Point::new(0, 0), self.screensize,
|
||||
|
|
@ -267,13 +258,9 @@ impl VaultUx {
|
|||
}
|
||||
)).expect("can't clear content area");
|
||||
}
|
||||
// dummy function for now - but this is where the action happens when input events come
|
||||
pub (crate) fn update(&mut self, _was_callback: bool) {
|
||||
self.redraw().unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn redraw(&mut self) -> Result<(), xous::Error> {
|
||||
self.clear_area();
|
||||
|
||||
// ---- draw title area ----
|
||||
let mut title_text = TextView::new(self.content,
|
||||
graphics_server::TextBounds::CenteredTop(
|
||||
|
|
@ -329,7 +316,7 @@ impl VaultUx {
|
|||
insert_at += self.item_height;
|
||||
}
|
||||
|
||||
log::trace!("vault app redraw##");
|
||||
log::debug!("vault app redraw##");
|
||||
self.gam.redraw().expect("couldn't redraw screen");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue