Skip to content

Commit

Permalink
tree: fix some issues with toplevel visibility handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Feb 14, 2024
1 parent d725a1e commit 0628a9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/ifs/wl_surface/x_surface/xwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ pub struct XwindowData {
tree_id!(XwindowId);
pub struct Xwindow {
pub id: XwindowId,
pub seat_state: NodeSeatState,
pub data: Rc<XwindowData>,
pub x: Rc<XSurface>,
pub display_link: RefCell<Option<LinkedNode<Rc<dyn StackedNode>>>>,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<Self>, visitor: &mut dyn NodeVisitor) {
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions src/tree/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tree/placeholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0628a9d

Please sign in to comment.