diff --git a/src/tree/container.rs b/src/tree/container.rs index 033c4a6f..37f1fa40 100644 --- a/src/tree/container.rs +++ b/src/tree/container.rs @@ -132,6 +132,7 @@ pub struct ContainerNode { pub sum_factors: Cell, pub layout_scheduled: Cell, animate_next_layout: Cell, + pub mono_transition_animation_pending: Cell, compute_render_positions_scheduled: Cell, num_children: NumCell, pub children: LinkedList, @@ -240,6 +241,7 @@ impl ContainerNode { sum_factors: Cell::new(1.0), layout_scheduled: Cell::new(false), animate_next_layout: Cell::new(false), + mono_transition_animation_pending: Cell::new(false), compute_render_positions_scheduled: Cell::new(false), num_children: NumCell::new(1), children, @@ -473,6 +475,7 @@ impl ContainerNode { fn perform_layout(self: &Rc) { self.layout_scheduled.set(false); if self.num_children.get() == 0 { + self.mono_transition_animation_pending.set(false); return; } if let Some(child) = self.mono_child.get() { @@ -490,6 +493,7 @@ impl ContainerNode { self.damage(); } } + self.mono_transition_animation_pending.set(false); } fn perform_mono_layout(self: &Rc, child: &ContainerChild) { @@ -823,6 +827,7 @@ impl ContainerNode { } } self.mono_child.set(child.clone()); + self.mono_transition_animation_pending.set(true); if child.is_some() { self.rebuild_tab_bar(); } else { diff --git a/src/tree/toplevel.rs b/src/tree/toplevel.rs index bc2accc4..5c8c1351 100644 --- a/src/tree/toplevel.rs +++ b/src/tree/toplevel.rs @@ -204,17 +204,22 @@ impl ToplevelNode for T { && !data.is_fullscreen.get() && data.kind.is_app_window() && !self.node_is_container(); - let parent_is_mono = data + let parent_container = data .parent .get() - .and_then(|parent| parent.node_into_container()) + .and_then(|parent| parent.node_into_container()); + let parent_is_mono = parent_container + .as_ref() .is_some_and(|container| container.mono_child.is_some()); + let parent_mono_transition = parent_container + .as_ref() + .is_some_and(|container| container.mono_transition_animation_pending.get()); let active_mono_boundary = matches!( hierarchy.transition, MultiphaseHierarchyTransition::EnteringMono | MultiphaseHierarchyTransition::ExitingMono - ) && (hierarchy.source.mono_active - || hierarchy.target.mono_active); + ) && parent_mono_transition + && (hierarchy.source.mono_active || hierarchy.target.mono_active); if prev != *rect && !prev.is_empty() && !rect.is_empty()