From 09908d8de846afe54471390d21ce2e486b6d3397 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 22 Jan 2020 06:57:45 +0300 Subject: [PATCH] anvil.window_map: rename surface to input_bbox Much clearer what it does. --- anvil/src/window_map.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/anvil/src/window_map.rs b/anvil/src/window_map.rs index 401c2e4..53ec2f3 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -37,7 +37,10 @@ where struct Window { 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, } @@ -55,7 +58,7 @@ where where 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; } // need to check more carefully @@ -133,7 +136,7 @@ where |_, _, _, _| true, ); } - self.surface = Rectangle { + self.input_bbox = Rectangle { x: min_x, y: min_y, width: max_x - min_x, @@ -164,7 +167,7 @@ where pub fn insert(&mut self, toplevel: Kind, location: (i32, i32)) { let mut window = Window { location, - surface: Rectangle { + input_bbox: Rectangle { x: 0, y: 0, width: 0,