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