1
0
Fork 0
forked from wry/wry

Constrain mono boundary animations

This commit is contained in:
atagen 2026-05-22 09:22:07 +10:00
parent 0fefe814c3
commit d2138b45f6
2 changed files with 14 additions and 4 deletions

View file

@ -132,6 +132,7 @@ pub struct ContainerNode {
pub sum_factors: Cell<f64>, pub sum_factors: Cell<f64>,
pub layout_scheduled: Cell<bool>, pub layout_scheduled: Cell<bool>,
animate_next_layout: Cell<bool>, animate_next_layout: Cell<bool>,
pub mono_transition_animation_pending: Cell<bool>,
compute_render_positions_scheduled: Cell<bool>, compute_render_positions_scheduled: Cell<bool>,
num_children: NumCell<usize>, num_children: NumCell<usize>,
pub children: LinkedList<ContainerChild>, pub children: LinkedList<ContainerChild>,
@ -240,6 +241,7 @@ impl ContainerNode {
sum_factors: Cell::new(1.0), sum_factors: Cell::new(1.0),
layout_scheduled: Cell::new(false), layout_scheduled: Cell::new(false),
animate_next_layout: Cell::new(false), animate_next_layout: Cell::new(false),
mono_transition_animation_pending: Cell::new(false),
compute_render_positions_scheduled: Cell::new(false), compute_render_positions_scheduled: Cell::new(false),
num_children: NumCell::new(1), num_children: NumCell::new(1),
children, children,
@ -473,6 +475,7 @@ impl ContainerNode {
fn perform_layout(self: &Rc<Self>) { fn perform_layout(self: &Rc<Self>) {
self.layout_scheduled.set(false); self.layout_scheduled.set(false);
if self.num_children.get() == 0 { if self.num_children.get() == 0 {
self.mono_transition_animation_pending.set(false);
return; return;
} }
if let Some(child) = self.mono_child.get() { if let Some(child) = self.mono_child.get() {
@ -490,6 +493,7 @@ impl ContainerNode {
self.damage(); self.damage();
} }
} }
self.mono_transition_animation_pending.set(false);
} }
fn perform_mono_layout(self: &Rc<Self>, child: &ContainerChild) { fn perform_mono_layout(self: &Rc<Self>, child: &ContainerChild) {
@ -823,6 +827,7 @@ impl ContainerNode {
} }
} }
self.mono_child.set(child.clone()); self.mono_child.set(child.clone());
self.mono_transition_animation_pending.set(true);
if child.is_some() { if child.is_some() {
self.rebuild_tab_bar(); self.rebuild_tab_bar();
} else { } else {

View file

@ -204,17 +204,22 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
&& !data.is_fullscreen.get() && !data.is_fullscreen.get()
&& data.kind.is_app_window() && data.kind.is_app_window()
&& !self.node_is_container(); && !self.node_is_container();
let parent_is_mono = data let parent_container = data
.parent .parent
.get() .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()); .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!( let active_mono_boundary = matches!(
hierarchy.transition, hierarchy.transition,
MultiphaseHierarchyTransition::EnteringMono MultiphaseHierarchyTransition::EnteringMono
| MultiphaseHierarchyTransition::ExitingMono | MultiphaseHierarchyTransition::ExitingMono
) && (hierarchy.source.mono_active ) && parent_mono_transition
|| hierarchy.target.mono_active); && (hierarchy.source.mono_active || hierarchy.target.mono_active);
if prev != *rect if prev != *rect
&& !prev.is_empty() && !prev.is_empty()
&& !rect.is_empty() && !rect.is_empty()