Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix(domain): exclude the container itself in `LastFocusedDescendantWithPredicate`

Lars Berger9aa86dacc580
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index 482eccaa..50b5f0be 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -157,7 +157,9 @@ namespace GlazeWM.Domain.Containers
{
var current = stack.Pop();
- var isMatch = !current.HasChildren() && predicate(current);
+ // The focused descendant cannot be the container itself or any containers that have
+ // children.
+ var isMatch = current != this && !current.HasChildren() && predicate(current);
if (isMatch)
return current;