tiling: Bugfixes for dragging windows

This commit is contained in:
Victoria Brekenfeld 2023-07-31 17:29:42 +02:00
parent 4a53e63c28
commit ac889f609d

View file

@ -131,7 +131,7 @@ pub enum MoveResult {
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
enum TargetZone { enum TargetZone {
InitialStackGrab, Initial,
InitialPlaceholder(NodeId), InitialPlaceholder(NodeId),
WindowStack(NodeId, Rectangle<i32, Logical>), WindowStack(NodeId, Rectangle<i32, Logical>),
WindowSplit(NodeId, Direction), WindowSplit(NodeId, Direction),
@ -1801,7 +1801,6 @@ impl TilingLayout {
} }
} }
_ => { _ => {
// shouldn't happen, but lets not loose the window
TilingLayout::map_to_tree( TilingLayout::map_to_tree(
&mut tree, &mut tree,
window.clone(), window.clone(),
@ -2334,7 +2333,15 @@ impl TilingLayout {
if node.children().iter().any(|child_id| { if node.children().iter().any(|child_id| {
tree.get(child_id) tree.get(child_id)
.ok() .ok()
.map(|child| child.data().is_placeholder()) .map(|child| {
matches!(
child.data(),
Data::Placeholder {
initial_placeholder: false,
..
}
)
})
.unwrap_or(false) .unwrap_or(false)
}) { }) {
None None
@ -2455,7 +2462,8 @@ impl TilingLayout {
Orientation::Horizontal => location.y < geo.loc.y, Orientation::Horizontal => location.y < geo.loc.y,
} }
}) })
.and_then(|x| x.checked_sub(1))?; .and_then(|x| x.checked_sub(1))
.unwrap_or(0);
Some(TargetZone::GroupInterior(res_id.clone(), idx)) Some(TargetZone::GroupInterior(res_id.clone(), idx))
} }
} }
@ -2547,7 +2555,7 @@ impl TilingLayout {
_ => false, _ => false,
}) })
.map(|node_id| TargetZone::InitialPlaceholder(node_id)) .map(|node_id| TargetZone::InitialPlaceholder(node_id))
.unwrap_or(TargetZone::InitialStackGrab), .unwrap_or(TargetZone::Initial),
)); ));
} }
Some((instant, old_target_zone)) => { Some((instant, old_target_zone)) => {