shell: implement surface_offset and surface_tree_offset

This commit is contained in:
Skygrango 2026-05-06 00:26:00 +08:00 • committed by Ian Douglas Scott
parent 22fe419747
commit 32b54cc31f
2 changed files with 74 additions and 1 deletions

View file

@ -254,6 +254,14 @@ impl CosmicMapped {
.any(|(w, _)| w.has_surface(surface, surface_type))
}
pub fn surface_offset(&self, surface: &WlSurface) -> Option<Point<i32, Logical>> {
self.windows().find_map(|(window, window_offset)| {
window
.surface_offset(surface)
.map(|offset| window_offset + offset)
})
}
/// Give the pointer target under a relative offset into this element.
///
/// Returns Target + Offset relative to the target