From d829ec3815ff8f767bea44f4e3e15ea02198e18e Mon Sep 17 00:00:00 2001 From: Skygrango Date: Fri, 8 May 2026 14:10:05 +0800 Subject: [PATCH] shell: implement has_surface for KeyboardFocusTarget --- src/shell/focus/target.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/shell/focus/target.rs b/src/shell/focus/target.rs index b177f00f..ef749a64 100644 --- a/src/shell/focus/target.rs +++ b/src/shell/focus/target.rs @@ -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)]