From 0628a9d393232d2b19465abb3ef58a77bedfa2c3 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 8 Feb 2024 16:57:47 +0100 Subject: [PATCH] tree: fix some issues with toplevel visibility handling --- src/ifs/wl_surface/x_surface/xwindow.rs | 6 ++---- src/tree/container.rs | 9 ++++++--- src/tree/placeholder.rs | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ifs/wl_surface/x_surface/xwindow.rs b/src/ifs/wl_surface/x_surface/xwindow.rs index fe092165..b13f044b 100644 --- a/src/ifs/wl_surface/x_surface/xwindow.rs +++ b/src/ifs/wl_surface/x_surface/xwindow.rs @@ -131,7 +131,6 @@ pub struct XwindowData { tree_id!(XwindowId); pub struct Xwindow { pub id: XwindowId, - pub seat_state: NodeSeatState, pub data: Rc, pub x: Rc, pub display_link: RefCell>>>, @@ -214,7 +213,6 @@ impl Xwindow { tld.pos.set(surface.extents.get()); let slf = Rc::new(Self { id: data.state.node_ids.next(), - seat_state: Default::default(), data: data.clone(), display_link: Default::default(), toplevel_data: tld, @@ -298,7 +296,7 @@ impl Node for Xwindow { } fn node_seat_state(&self) -> &NodeSeatState { - &self.seat_state + &self.toplevel_data.seat_state } fn node_visit(self: Rc, visitor: &mut dyn NodeVisitor) { @@ -422,7 +420,7 @@ impl ToplevelNode for Xwindow { fn tl_set_visible(&self, visible: bool) { self.x.surface.set_visible(visible); - self.seat_state.set_visible(self, visible); + self.toplevel_data.set_visible(self, visible); } fn tl_destroy(&self) { diff --git a/src/tree/container.rs b/src/tree/container.rs index aebfdd59..4f0bcf00 100644 --- a/src/tree/container.rs +++ b/src/tree/container.rs @@ -1429,9 +1429,12 @@ impl ToplevelNode for ContainerNode { } fn tl_set_visible(&self, visible: bool) { - self.toplevel_data.visible.set(visible); - for child in self.children.iter() { - child.node.tl_set_visible(visible); + if let Some(mc) = self.mono_child.get() { + mc.node.tl_set_visible(visible); + } else { + for child in self.children.iter() { + child.node.tl_set_visible(visible); + } } self.toplevel_data.set_visible(self, visible); } diff --git a/src/tree/placeholder.rs b/src/tree/placeholder.rs index e259d550..c5bdcceb 100644 --- a/src/tree/placeholder.rs +++ b/src/tree/placeholder.rs @@ -179,7 +179,7 @@ impl ToplevelNode for PlaceholderNode { } fn tl_set_visible(&self, visible: bool) { - self.toplevel.visible.set(visible); + self.toplevel.set_visible(self, visible); } fn tl_destroy(&self) {