anvil.window_map: rename input_bbox to bbox

Since this value turns out to be more useful than for just input fast
path.
This commit is contained in:
Ivan Molodetskikh 2020-02-03 12:10:36 +03:00
parent 7fa7fe03be
commit 5814626dbe
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
1 changed files with 7 additions and 6 deletions

View File

@ -46,10 +46,11 @@ where
struct Window<R> { struct Window<R> {
location: (i32, i32), location: (i32, i32),
/// A bounding box over the input areas of this window and its children. /// A bounding box over this window and its children.
/// ///
/// Used for the fast path of the check in `matching`. /// Used for the fast path of the check in `matching`, and as the fall-back for the window
input_bbox: Rectangle, /// geometry if that's not set explicitly.
bbox: Rectangle,
toplevel: Kind<R>, toplevel: Kind<R>,
} }
@ -71,7 +72,7 @@ where
where where
F: Fn(&SurfaceAttributes, (f64, f64)) -> bool, F: Fn(&SurfaceAttributes, (f64, f64)) -> bool,
{ {
if !self.input_bbox.contains((point.0 as i32, point.1 as i32)) { if !self.bbox.contains((point.0 as i32, point.1 as i32)) {
return None; return None;
} }
// need to check more carefully // need to check more carefully
@ -143,7 +144,7 @@ where
|_, _, _, _| true, |_, _, _, _| true,
); );
} }
self.input_bbox = Rectangle { self.bbox = Rectangle {
x: min_x, x: min_x,
y: min_y, y: min_y,
width: max_x - min_x, width: max_x - min_x,
@ -179,7 +180,7 @@ where
pub fn insert(&mut self, toplevel: Kind<R>, location: (i32, i32)) { pub fn insert(&mut self, toplevel: Kind<R>, location: (i32, i32)) {
let mut window = Window { let mut window = Window {
location, location,
input_bbox: Rectangle::default(), bbox: Rectangle::default(),
toplevel, toplevel,
}; };
window.self_update(self.ctoken, &self.get_size); window.self_update(self.ctoken, &self.get_size);