Skip to content

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

feat(domain): throw error when attempting to move + resize a non-resizable container

Lars Bergerb117c4b633bb
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
index 7a00ead9..94250dbe 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Utils;
@@ -23,6 +24,9 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
var targetIndex = command.TargetIndex;
var shouldAdjustSize = command.ShouldAdjustSize;
+ if (shouldAdjustSize && !(containerToMove is IResizable))
+ throw new Exception("Cannot resize a non-resizable container. This is a bug.");
+
// Get lowest common ancestor (LCA) between `containerToMove` and `targetParent`. This could
// be the `targetParent` itself.
var lowestCommonAncestor = _containerService.GetLowestCommonAncestor(