remove draw_order from TextView

We can't support this anyways, because the textviews are
immediately drawn on call by the calling app
This commit is contained in:
bunnie 2021-03-11 18:52:10 +08:00
parent 54cf95aec1
commit 443e4a1444
4 changed files with 8 additions and 13 deletions

View file

@ -25,7 +25,7 @@ pub fn status_thread(canvas_gid: [u32; 4]) {
if debug1{info!("GAM|status: building textview objects");}
// build uptime text view: left half of status bar
let mut uptime_tv = TextView::new(status_gid, 0,
let mut uptime_tv = TextView::new(status_gid,
TextBounds::BoundingBox(Rectangle::new(Point::new(0,0),
Point::new(screensize.x / 2, screensize.y - 1))));
uptime_tv.untrusted = false;
@ -37,7 +37,7 @@ pub fn status_thread(canvas_gid: [u32; 4]) {
if debug1{info!("GAM|status: uptime initialized to '{:?}'", uptime_tv);}
// build battstats text view: right half of status bar
let mut battstats_tv = TextView::new(status_gid, 0,
let mut battstats_tv = TextView::new(status_gid,
TextBounds::BoundingBox(Rectangle::new(Point::new(screensize.x / 2, 0),
Point::new(screensize.x, screensize.y - 1))));
battstats_tv.style = blitstr::GlyphStyle::Small;

View file

@ -54,9 +54,6 @@ pub struct TextView {
pub token: Option<[u32; 4]>, // optional 128-bit token which is presented to prove a field's trustability
pub invert: bool, // only trusted, token-validated TextViews will have the invert bit respected
// lower numbers are drawn last
pub draw_order: u32,
// offsets for text drawing -- exactly one of the following options should be specified
// note that the TextBounds coordinate system is local to the canvas, not the screen
pub bounds_hint: TextBounds,
@ -83,13 +80,12 @@ pub struct TextView {
pub clip_rect: Option<Rectangle>, // this is set by the GAM to the canvas' clip_rect; needed by gfx for drawing. Note this is in screen coordinates.
}
impl TextView {
pub fn new(canvas: Gid, draw_order: u32, bounds_hint: TextBounds) -> Self {
pub fn new(canvas: Gid, bounds_hint: TextBounds) -> Self {
TextView {
operation: TextOp::Nop,
untrusted: true,
token: None,
invert: false,
draw_order,
clip_rect: None,
bounds_hint,
bounds_computed: None,
@ -124,7 +120,6 @@ impl TextView {
self.untrusted = t.untrusted;
self.token = t.token;
self.invert = t.invert;
self.draw_order = t.draw_order;
self.bounds_hint = t.bounds_hint;
self.bounds_computed = t.bounds_computed;
self.style = t.style;

View file

@ -219,7 +219,7 @@ impl InputTracker {
if let Some(ic) = self.input_canvas {
if debug1{info!("IMEF: updating input area");}
let ic_bounds: Point = gam::get_canvas_bounds(self.gam_conn, ic).expect("IMEF: Couldn't get input canvas bounds");
let mut input_tv = TextView::new(ic, 255,
let mut input_tv = TextView::new(ic,
TextBounds::BoundingBox(Rectangle::new(Point::new(0,1), ic_bounds)));
input_tv.draw_border = false;
input_tv.border_width = 1;
@ -524,7 +524,7 @@ impl InputTracker {
}
if valid_predictions == 0 {
let mut empty_tv = TextView::new(pc, 255,
let mut empty_tv = TextView::new(pc,
TextBounds::BoundingBox(Rectangle::new(Point::new(0, 1), pc_bounds)));
empty_tv.draw_border = false;
empty_tv.border_width = 1;
@ -554,7 +554,7 @@ impl InputTracker {
DrawStyle { fill_color: None, stroke_color: Some(PixelColor::Dark), stroke_width: 1 }
)).expect("IMEF: couldn't draw dividing lines in prediction area");
}
let mut p_tv = TextView::new(pc, 255,
let mut p_tv = TextView::new(pc,
TextBounds::BoundingBox(p_clip));
p_tv.draw_border = false;
p_tv.border_width = 1;

View file

@ -153,12 +153,12 @@ impl Repl{
for h in self.history.iter().rev() {
let mut bubble_tv =
if h.is_input {
TextView::new(self.content, 255,
TextView::new(self.content,
TextBounds::GrowableFromBr(
Point::new(self.screensize.x - self.margin.x, bubble_baseline),
self.bubble_width))
} else {
TextView::new(self.content, 255,
TextView::new(self.content,
TextBounds::GrowableFromBl(
Point::new(self.margin.x, bubble_baseline),
self.bubble_width))