anvil.window_map: add some comments

This commit is contained in:
Ivan Molodetskikh 2020-01-22 06:58:41 +03:00
parent 09908d8de8
commit 9bfa85efc9
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
1 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,8 @@ impl<R> Window<R>
where
R: Role<SubsurfaceRole> + Role<XdgSurfaceRole> + Role<ShellSurfaceRole> + 'static,
{
// Find the topmost surface under this point if any and 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<F>(
&self,
point: (f64, f64),
@ -109,6 +110,8 @@ where
wl_surface,
(base_x, base_y),
|_, attributes, role, &(mut x, mut y)| {
// The input region is intersected with the surface size, so the surface size
// can serve as an approximation for the input bounding box.
if let Some((w, h)) = get_size(attributes) {
if let Ok(subdata) = Role::<SubsurfaceRole>::data(role) {
x += subdata.location.0;
@ -148,6 +151,7 @@ where
pub struct WindowMap<R, F> {
ctoken: CompositorToken<R>,
windows: Vec<Window<R>>,
/// A function returning the surface size.
get_size: F,
}