Skip to content

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

refactor(domain): simplify `LastFocusedChild` getter

Lars Berger98de47710c80
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index e0fae7a0..e1f84c79 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -19,24 +19,9 @@ namespace GlazeWM.Domain.Containers
public List<Container> ChildFocusOrder { get; set; } = new List<Container>();
/// <summary>
- /// The child container that last had focus. Return the first child if no children have
- /// had focus yet.
+ /// The child container that last had focus.
/// </summary>
- public Container LastFocusedChild
- {
- get
- {
- if (ChildFocusOrder.Count > 0)
- return ChildFocusOrder[0];
-
- // TODO: Remove this conditional and instead always return
- // `ChildFocusOrder.ElementAtOrDefault(0)`.
- if (Children.Count > 0)
- return Children[0];
-
- return null;
- }
- }
+ public Container LastFocusedChild => ChildFocusOrder.ElementAtOrDefault(0);
/// <summary>
/// Index of this container in parent's child focus order.