fn matching(&self, point: Point<f64, Logical>) -> Option<(wl_surface::WlSurface, Point<i32, Logical>)> {
        if !self.bbox.to_f64().contains(point) {
            return None;
        }
        // need to check more carefully
        let found = RefCell::new(None);
        if let Some(wl_surface) = self.toplevel.get_surface() {
            with_surface_tree_downward(
                wl_surface,
                self.location,
                |wl_surface, states, location| {
                    let mut location = *location;
                    let data = states.data_map.get::<RefCell<SurfaceData>>();

                    if states.role == Some("subsurface") {
                        let current = states.cached_state.current::<SubsurfaceCachedState>();
                        location += current.location;
                    }

                    let contains_the_point = data
                        .map(|data| {
                            data.borrow()
                                .contains_point(&*states.cached_state.current(), point - location.to_f64())
                        })
                        .unwrap_or(false);
                    if contains_the_point {
                        *found.borrow_mut() = Some((wl_surface.clone(), location));
                    }

                    TraversalAction::DoChildren(location)
                },
                |_, _, _| {},
                |_, _, _| {
                    // only continue if the point is not found
                    found.borrow().is_none()
                },
            );
        }
        found.into_inner()
    }
/// Finds the topmost surface under this point if any and returns it together with the location of this
/// surface.
Finds the topmost surface under this point if any and returns it together with the location of this
surface.
Finds the topmost surface under this point if any and returns it together with the location of this surface .
fn matching(&self, point: Point<f64, Logical>) -> Option<(wl_surface::WlSurface, Point<i32, Logical>)> {
        if !self.bbox.to_f64().contains(point) {
            return None;
        }
        // need to check more carefully
        let found = RefCell::new(None);
        if let Some(wl_surface) = self.toplevel.get_surface() {
            with_surface_tree_downward(
                wl_surface,
                self.location,
                |wl_surface, states, location| {
                    let mut location = *location;
                    let data = states.data_map.get::<RefCell<SurfaceData>>();
                    if states.role == Some("subsurface") {
                        let current = states.cached_state.current::<SubsurfaceCachedState>();
                        location += current.location;
                    }
                    let contains_the_point = data
                        .map(|data| {
                            data.borrow()
                                .contains_point(&*states.cached_state.current(), point - location.to_f64())
                        })
                        .unwrap_or(false);
                    if contains_the_point {
                        *found.borrow_mut() = Some((wl_surface.clone(), location));
                    }
                    TraversalAction::DoChildren(location)
                },
                |_, _, _| {},
                |_, _, _| {
                    // only continue if the point is not found
                    found.borrow().is_none()
                },
            );
        }
        found.into_inner()
    }
fn matching ( & self , point : Point < f64 , Logical > ) -> Option < ( wl_surface :: WlSurface , Point < i32 , Logical > ) > { if ! self . bbox . to_f64 ( ) . contains ( point ) { return None ; } // need to check more carefully let found = RefCell :: new ( None ) ; if let Some ( wl_surface ) = self . toplevel . get_surface ( ) { with_surface_tree_downward ( wl_surface , self . location , | wl_surface , states , location | { let mut location = * location ; let data = states . data_map . get :: < RefCell < SurfaceData > > ( ) ; if states . role == Some ( " " ) { let current = states . cached_state . current :: < SubsurfaceCachedState > ( ) ; location += current . location ; } let contains_the_point = data . map ( | data | { data . borrow ( ) . contains_point ( & * states . cached_state . current ( ) , point - location . to_f64 ( ) ) } ) . unwrap_or ( false ) ; if contains_the_point { * found . borrow_mut ( ) = Some ( ( wl_surface . clone ( ) , location ) ) ; } TraversalAction :: DoChildren ( location ) } , | _ , _ , _ | { } , | _ , _ , _ | { // only continue if the point is not found found . borrow ( ) . is_none ( ) } , ) ; } found . into_inner ( ) }
Finds the topmost surface under this point if any and returns it together with the location of this
surface.
Finds the topmost surface under this point if any and returns it together with the location of this surface .
&self
point
Point<f64, Logical>
&self
point
Point<f64, Logical>