GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): throw error when attempting to attach/detach and resize a non-resizable container
Lars Bergeraa65064d108f
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.csindex 5cdd4bc3..17339a8c 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs@@ -1,3 +1,4 @@+using System;using System.Linq;using GlazeWM.Domain.Containers.Commands;using GlazeWM.Infrastructure.Bussing;@@ -20,10 +21,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlersvar targetIndex = command.TargetIndex;if (!(childToAdd is IResizable))- {- _bus.Invoke(new AttachContainerCommand(childToAdd, targetParent, targetIndex));- return CommandResponse.Ok;- }+ throw new Exception("Cannot resize a non-resizable container. This is a bug.");_bus.Invoke(new AttachContainerCommand(childToAdd, targetParent, targetIndex));diff --git a/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.csindex fbe93e12..64d976ee 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/DetachAndResizeContainerHandler.cs@@ -1,4 +1,5 @@-using System.Linq;+using System;+using System.Linq;using GlazeWM.Domain.Containers.Commands;using GlazeWM.Domain.Workspaces;using GlazeWM.Infrastructure.Bussing;@@ -20,12 +21,8 @@ namespace GlazeWM.Domain.Containers.CommandHandlersvar parent = childToRemove.Parent;var grandparent = parent.Parent;- // Avoid resizing containers that aren't resizable.if (!(childToRemove is IResizable))- {- _bus.Invoke(new DetachContainerCommand(childToRemove));- return CommandResponse.Ok;- }+ throw new Exception("Cannot resize a non-resizable container. This is a bug.");var isEmptySplitContainer = parent is SplitContainer && parent.Children.Count() == 1&& !(parent is Workspace);