Skip to content

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

feat(domain): handle sizing/location of vertical layouts in RedrawContainersHandler

Larsd7380ffc1f69
diff --git a/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs b/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
index 8b4166f5..dfb585d6 100644
--- a/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
+++ b/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
@@ -60,6 +60,31 @@ namespace LarsWM.Domain.Containers.CommandHandlers
previousChild = child;
}
}
+
+ if (parentContainer.Layout == Layout.Vertical)
+ {
+ // Available parent height is the height of the parent minus all inner gaps.
+ var availableParentHeight = parentContainer.Height - (innerGap * (children.Count - 1));
+
+ // Adjust size and location of child containers.
+ Container previousChild = null;
+ foreach (var child in children)
+ {
+ // Direct children of parent have the same width and X coord as parent in vertical layouts.
+ child.Width = parentContainer.Width;
+ child.X = parentContainer.X;
+
+ child.Height = (int)(child.SizePercentage * availableParentHeight);
+
+ if (previousChild == null)
+ child.Y = parentContainer.Y;
+
+ else
+ child.Y = previousChild.Y + previousChild.Height + innerGap;
+
+ previousChild = child;
+ }
+ }
}
PushUpdates(containersToRedraw);