anvil.window_map: rename surface to input_bbox

Much clearer what it does.
This commit is contained in:
Ivan Molodetskikh 2020-01-22 06:57:45 +03:00
parent 0140de89fb
commit 09908d8de8
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
1 changed files with 7 additions and 4 deletions

View File

@ -37,7 +37,10 @@ where
struct Window<R> { struct Window<R> {
location: (i32, i32), location: (i32, i32),
surface: Rectangle, /// A bounding box over the input areas of this window and its children.
///
/// Used for the fast path of the check in `matching`.
input_bbox: Rectangle,
toplevel: Kind<R>, toplevel: Kind<R>,
} }
@ -55,7 +58,7 @@ where
where where
F: Fn(&SurfaceAttributes) -> Option<(i32, i32)>, F: Fn(&SurfaceAttributes) -> Option<(i32, i32)>,
{ {
if !self.surface.contains((point.0 as i32, point.1 as i32)) { if !self.input_bbox.contains((point.0 as i32, point.1 as i32)) {
return None; return None;
} }
// need to check more carefully // need to check more carefully
@ -133,7 +136,7 @@ where
|_, _, _, _| true, |_, _, _, _| true,
); );
} }
self.surface = Rectangle { self.input_bbox = Rectangle {
x: min_x, x: min_x,
y: min_y, y: min_y,
width: max_x - min_x, width: max_x - min_x,
@ -164,7 +167,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,
surface: Rectangle { input_bbox: Rectangle {
x: 0, x: 0,
y: 0, y: 0,
width: 0, width: 0,