From f00b8075e0e0c409ae62f51db540dce774d52544 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Wed, 14 May 2025 17:53:16 +0200 Subject: [PATCH] tree: don't make xdg-popup visible if parent is not visible --- src/ifs/wl_surface/tray.rs | 4 ++++ src/ifs/wl_surface/xdg_surface.rs | 4 ++++ src/ifs/wl_surface/xdg_surface/xdg_popup.rs | 8 ++++++++ src/ifs/wl_surface/zwlr_layer_surface_v1.rs | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/src/ifs/wl_surface/tray.rs b/src/ifs/wl_surface/tray.rs index 12d5aecb..cdc732fe 100644 --- a/src/ifs/wl_surface/tray.rs +++ b/src/ifs/wl_surface/tray.rs @@ -208,6 +208,10 @@ impl XdgPopupParent for Popup { } } + fn visible(&self) -> bool { + self.parent.node_visible() + } + fn tray_item(&self) -> Option { Some(self.parent.data().tray_item_id) } diff --git a/src/ifs/wl_surface/xdg_surface.rs b/src/ifs/wl_surface/xdg_surface.rs index 9477c92c..520aa929 100644 --- a/src/ifs/wl_surface/xdg_surface.rs +++ b/src/ifs/wl_surface/xdg_surface.rs @@ -140,6 +140,10 @@ impl XdgPopupParent for Popup { } } + fn visible(&self) -> bool { + self.parent.surface.visible.get() + } + fn tray_item(&self) -> Option { self.parent.clone().tray_item() } diff --git a/src/ifs/wl_surface/xdg_surface/xdg_popup.rs b/src/ifs/wl_surface/xdg_surface/xdg_popup.rs index 7544b529..4097610b 100644 --- a/src/ifs/wl_surface/xdg_surface/xdg_popup.rs +++ b/src/ifs/wl_surface/xdg_surface/xdg_popup.rs @@ -44,6 +44,7 @@ pub trait XdgPopupParent { fn output(&self) -> Rc; fn has_workspace_link(&self) -> bool; fn post_commit(&self); + fn visible(&self) -> bool; fn tray_item(&self) -> Option { None } @@ -369,6 +370,13 @@ impl StackedNode for XdgPopup { } fn stacked_set_visible(&self, visible: bool) { + if visible { + if let Some(parent) = self.parent.get() { + if !parent.visible() { + return; + } + } + } self.set_visible(visible); } diff --git a/src/ifs/wl_surface/zwlr_layer_surface_v1.rs b/src/ifs/wl_surface/zwlr_layer_surface_v1.rs index 0da67246..7f7aa86e 100644 --- a/src/ifs/wl_surface/zwlr_layer_surface_v1.rs +++ b/src/ifs/wl_surface/zwlr_layer_surface_v1.rs @@ -715,6 +715,10 @@ impl XdgPopupParent for Popup { } } } + + fn visible(&self) -> bool { + self.parent.node_visible() + } } object_base! {