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