From 973b36051442f1785ed50c9c5f215402e66c5d94 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 14 Sep 2023 16:18:13 +0200 Subject: [PATCH] tiling: Fix stack indicator rendering --- src/shell/layout/tiling/mod.rs | 37 +++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 983f44bd..a0f85aae 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -4968,7 +4968,25 @@ where } if focused.as_ref() == Some(&node_id) - && swap_desc.as_ref().map(|desc| &desc.node) != Some(&node_id) + && (swap_desc.as_ref().map(|desc| &desc.node) != Some(&node_id) + || swap_desc + .as_ref() + .and_then(|swap_desc| swap_desc.stack_window.as_ref()) + .zip(focused.as_ref()) + .map(|(stack_window, focused_id)| { + target_tree + .get(focused_id) + .ok() + .map(|focused| match focused.data() { + Data::Mapped { mapped, .. } => mapped + .stack_ref() + .map(|stack| &stack.active() != stack_window) + .unwrap_or(false), + _ => unreachable!(), + }) + .unwrap_or(false) + }) + .unwrap_or(false)) { if let Some(swap) = swap_indicator.as_ref() { swap.resize(geo.size); @@ -5037,8 +5055,21 @@ where ); if swap_desc .as_ref() - .map(|swap_desc| { - &swap_desc.node == &node_id && swap_desc.stack_window.is_some() + .filter(|swap_desc| swap_desc.node == node_id) + .and_then(|swap_desc| swap_desc.stack_window.as_ref()) + .zip(focused.as_ref()) + .map(|(stack_window, focused_id)| { + target_tree + .get(focused_id) + .ok() + .map(|focused| match focused.data() { + Data::Mapped { mapped, .. } => mapped + .stack_ref() + .map(|stack| &stack.active() == stack_window) + .unwrap_or(false), + _ => unreachable!(), + }) + .unwrap_or(false) }) .unwrap_or(false) {