From 9a3bfb4bba8d8a2ad69c93c935eb46a7d46195d2 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 28 Jul 2023 14:20:50 +0200 Subject: [PATCH] tiling: Draw indicators for group lower than pill indicator --- src/shell/layout/tiling/mod.rs | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 0b08e696..d5a2c4dd 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -3177,6 +3177,73 @@ where .into(), ); } + + if mouse_tiling.is_some() + && node + .parent() + .map(|parent_id| { + matches!( + tree.get(&parent_id).unwrap().data(), + Data::Group { + pill_indicator: Some(_), + .. + } + ) + }) + .unwrap_or(false) + { + // test if parent pill-indicator is adjacent + let parent_id = node.parent().unwrap(); + let parent = tree.get(parent_id).unwrap(); + let own_idx = tree + .children_ids(parent_id) + .unwrap() + .position(|child_id| child_id == &node_id) + .unwrap(); + let draw_outline = match parent.data() { + Data::Group { + pill_indicator, + orientation, + .. + } => match pill_indicator { + Some(PillIndicator::Inner(pill_idx)) => { + *pill_idx == own_idx || pill_idx + 1 == own_idx + } + Some(PillIndicator::Outer(dir)) => match (dir, orientation) + { + (Direction::Left, Orientation::Horizontal) + | (Direction::Right, Orientation::Horizontal) + | (Direction::Up, Orientation::Vertical) + | (Direction::Down, Orientation::Vertical) => true, + (Direction::Left, Orientation::Vertical) + | (Direction::Up, Orientation::Horizontal) => { + own_idx == 0 + } + (Direction::Right, Orientation::Vertical) + | (Direction::Down, Orientation::Horizontal) => { + own_idx + 1 == parent.data().len() + } + }, + None => unreachable!(), + }, + _ => unreachable!(), + }; + + if draw_outline { + elements.push( + IndicatorShader::element( + *renderer, + Key::Group(Arc::downgrade(alive)), + geo, + 4, + 8, + alpha * 0.15, + GROUP_COLOR, + ) + .into(), + ); + } + } } geo.loc += (gap, gap).into();