diff --git a/src/it/tests/t0022_toplevel_suspended.rs b/src/it/tests/t0022_toplevel_suspended.rs index 524856e3..5e871575 100644 --- a/src/it/tests/t0022_toplevel_suspended.rs +++ b/src/it/tests/t0022_toplevel_suspended.rs @@ -3,11 +3,9 @@ use { ifs::wl_surface::xdg_surface::xdg_toplevel::STATE_SUSPENDED, it::{ test_error::{TestErrorExt, TestResult}, - test_utils::{ - test_ouput_node_ext::TestOutputNodeExt, test_toplevel_node_ext::TestToplevelNodeExt, - }, testrun::TestRun, }, + tree::Node, }, isnt::std_1::collections::IsntHashSetExt, std::{rc::Rc, time::Duration}, @@ -29,7 +27,7 @@ async fn test(run: Rc) -> TestResult { win2.set_color(0, 255, 0, 255); win2.map2().await?; - let (x, y) = ds.output.first_toplevel()?.center(); + let (x, y) = win1.tl.server.node_absolute_position().center(); ds.move_to(x, y); tassert!(win2.tl.core.states.borrow().not_contains(&STATE_SUSPENDED)); @@ -45,6 +43,10 @@ async fn test(run: Rc) -> TestResult { client.sync().await; tassert!(win2.tl.core.states.borrow().not_contains(&STATE_SUSPENDED)); + let (x, y) = win2.tl.server.node_absolute_position().center(); + ds.move_to(x, y); + client.sync().await; + let leaves = default_seat.kb.leave.expect()?; let enters = default_seat.kb.enter.expect()?; diff --git a/src/state.rs b/src/state.rs index d10ff054..a80a73ce 100644 --- a/src/state.rs +++ b/src/state.rs @@ -4,12 +4,11 @@ use { allocator::BufferObject, animation::{ AnimationCurve, AnimationState, AnimationStyle, AnimationTick, RetainedExitLayer, - RetainedToplevel, - expand_damage_rect, + RetainedToplevel, expand_damage_rect, multiphase::{ MultiphasePhase, MultiphasePlan, MultiphasePlanFailure, MultiphaseRequest, - MultiphaseWindow, MultiphaseWindowHierarchy, - partition_motion_groups, plan_no_overlap_with_diagnostics, validate_phase_paths, + MultiphaseWindow, MultiphaseWindowHierarchy, partition_motion_groups, + plan_no_overlap_with_diagnostics, validate_phase_paths, }, spawn_in_start_rect, }, @@ -224,10 +223,7 @@ fn bridged_retarget_plan( return Err(MultiphasePlanFailure::NoPattern); }; let mut path = bridge_path.clone(); - let mut current = path - .last() - .map(|(_, to)| *to) - .unwrap_or(window.from); + let mut current = path.last().map(|(_, to)| *to).unwrap_or(window.from); while path.len() < bridge_phase_count { path.push((current, current)); } @@ -996,6 +992,12 @@ impl State { } else { lap.add_child_after(&*la, node); } + } else if let Some(last) = c.children.last() { + if autotile { + c.add_tiled_child_after(&*last.node, node); + } else { + c.add_child_after(&*last.node, node); + } } else { c.append_child(node); } @@ -1749,12 +1751,7 @@ impl State { self.eng.now().msec() } - pub fn queue_tiled_animation( - self: &Rc, - node_id: NodeId, - old: Rect, - new: Rect, - ) { + pub fn queue_tiled_animation(self: &Rc, node_id: NodeId, old: Rect, new: Rect) { let curve = self .layout_animation_curve_override .get() @@ -1782,12 +1779,7 @@ impl State { self.queue_layout_animation(node_id, old, new, curve, hierarchy); } - pub fn queue_linear_layout_animation( - self: &Rc, - node_id: NodeId, - old: Rect, - new: Rect, - ) { + pub fn queue_linear_layout_animation(self: &Rc, node_id: NodeId, old: Rect, new: Rect) { self.queue_layout_animation( node_id, old, @@ -2140,11 +2132,7 @@ impl State { started_any } - pub fn queue_spawn_in_animation( - self: &Rc, - node_id: NodeId, - target: Rect, - ) { + pub fn queue_spawn_in_animation(self: &Rc, node_id: NodeId, target: Rect) { if !self.animations.enabled.get() || target.is_empty() { return; } @@ -2805,10 +2793,7 @@ impl State { #[cfg(test)] mod tests { - use { - super::*, - crate::animation::multiphase::MultiphaseHierarchyPosition, - }; + use {super::*, crate::animation::multiphase::MultiphaseHierarchyPosition}; fn rect(x1: i32, y1: i32, x2: i32, y2: i32) -> Rect { Rect::new_saturating(x1, y1, x2, y2) @@ -2822,12 +2807,7 @@ mod tests { } fn candidate(node_id: u32, style: AnimationStyle) -> LayoutAnimationCandidate { - candidate_rects( - node_id, - rect(0, 0, 100, 100), - rect(100, 0, 200, 100), - style, - ) + candidate_rects(node_id, rect(0, 0, 100, 100), rect(100, 0, 200, 100), style) } fn candidate_rects( @@ -2898,14 +2878,16 @@ mod tests { ) .unwrap(); - assert!(plan - .phases - .iter() - .any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(1)))); - assert!(plan - .phases - .iter() - .any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(3)))); + assert!( + plan.phases + .iter() + .any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(1))) + ); + assert!( + plan.phases + .iter() + .any(|phase| phase.steps.iter().any(|step| step.node_id == NodeId(3))) + ); } #[test] diff --git a/src/tree/container.rs b/src/tree/container.rs index 44a6a778..e9363106 100644 --- a/src/tree/container.rs +++ b/src/tree/container.rs @@ -2633,6 +2633,9 @@ impl ToplevelNodeBase for ContainerNode { if let Some(last) = self.focus_history.last() { return last.node.clone().tl_last_active_child(); } + if let Some(last) = self.children.last() { + return last.node.clone().tl_last_active_child(); + } self }