shell: implement has_surface for KeyboardFocusTarget

This commit is contained in:
Skygrango 2026-05-08 14:10:05 +08:00 committed by Ian Douglas Scott
parent 32b54cc31f
commit d829ec3815

View file

@ -281,6 +281,18 @@ impl KeyboardFocusTarget {
false
}
}
pub fn has_surface(&self, shell: &Shell, surface: &WlSurface) -> bool {
if let Some(fe) = shell.focused_element(self) {
fe.has_surface(surface, WindowSurfaceType::ALL)
} else if let KeyboardFocusTarget::Fullscreen(s) = self {
s.has_surface(surface, WindowSurfaceType::ALL)
} else if let Some(root) = WaylandFocus::wl_surface(self) {
CosmicSurface::surface_tree_offset(&root, surface).is_some()
} else {
false
}
}
}
#[derive(Debug, Clone)]