1
0
Fork 0
forked from wry/wry

Carry hierarchy metadata into multiphase planning

This commit is contained in:
atagen 2026-05-21 19:55:16 +10:00
parent a712786ecf
commit 90c00bcdf3
4 changed files with 276 additions and 16 deletions

View file

@ -6,7 +6,8 @@ use {
AnimationCurve, AnimationState, AnimationTick, RetainedExitLayer, RetainedToplevel,
expand_damage_rect,
multiphase::{
MultiphaseRequest, MultiphaseWindow, partition_motion_groups, plan_no_overlap,
MultiphaseRequest, MultiphaseWindow, MultiphaseWindowHierarchy,
partition_motion_groups, plan_no_overlap,
},
spawn_in_start_rect,
},
@ -168,6 +169,7 @@ pub(crate) struct LayoutAnimationCandidate {
new: Rect,
retained: Option<Rc<RetainedToplevel>>,
curve: AnimationCurve,
hierarchy: MultiphaseWindowHierarchy,
}
pub struct State {
@ -1500,7 +1502,29 @@ impl State {
.layout_animation_curve_override
.get()
.unwrap_or_else(|| self.animations.curve.get());
self.queue_layout_animation(node_id, old, new, retained, curve);
self.queue_layout_animation(
node_id,
old,
new,
retained,
curve,
MultiphaseWindowHierarchy::default(),
);
}
pub fn queue_tiled_animation_with_hierarchy(
self: &Rc<Self>,
node_id: NodeId,
old: Rect,
new: Rect,
retained: Option<Rc<RetainedToplevel>>,
hierarchy: MultiphaseWindowHierarchy,
) {
let curve = self
.layout_animation_curve_override
.get()
.unwrap_or_else(|| self.animations.curve.get());
self.queue_layout_animation(node_id, old, new, retained, curve, hierarchy);
}
pub fn queue_linear_layout_animation(
@ -1510,7 +1534,14 @@ impl State {
new: Rect,
retained: Option<Rc<RetainedToplevel>>,
) {
self.queue_layout_animation(node_id, old, new, retained, AnimationCurve::Linear);
self.queue_layout_animation(
node_id,
old,
new,
retained,
AnimationCurve::Linear,
MultiphaseWindowHierarchy::default(),
);
}
fn queue_layout_animation(
@ -1520,6 +1551,7 @@ impl State {
new: Rect,
retained: Option<Rc<RetainedToplevel>>,
curve: AnimationCurve,
hierarchy: MultiphaseWindowHierarchy,
) {
if !self.animations.enabled.get()
|| !self.layout_animations_active.get()
@ -1546,6 +1578,7 @@ impl State {
new,
retained,
curve,
hierarchy,
};
if let Some(batch) = self.layout_animation_batch.borrow_mut().as_mut() {
batch.push(candidate);
@ -1590,12 +1623,14 @@ impl State {
let now = self.now_nsec();
let windows: Vec<_> = candidates
.iter()
.map(|candidate| MultiphaseWindow {
node_id: candidate.node_id,
from: self
.animations
.visual_rect(candidate.node_id, candidate.old, now),
to: candidate.new,
.map(|candidate| {
MultiphaseWindow::with_hierarchy(
candidate.node_id,
self.animations
.visual_rect(candidate.node_id, candidate.old, now),
candidate.new,
candidate.hierarchy,
)
})
.collect();
for group in partition_motion_groups(&windows) {