GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
refactor(domain): change naming/order of args in container-related commands to be more consistent
Lars Berger22eb2d0e9e58
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.csindex c6bfa975..d41fa823 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/AttachAndResizeContainerHandler.cs@@ -16,14 +16,14 @@ namespace GlazeWM.Domain.Containers.CommandHandlerspublic CommandResponse Handle(AttachAndResizeContainerCommand command){- var parent = command.Parent;var childToAdd = command.ChildToAdd;- var insertPosition = command.InsertPosition;+ var targetParent = command.TargetParent;+ var targetIndex = command.TargetIndex;if (!(childToAdd is TilingWindow || childToAdd is SplitContainer))return CommandResponse.Ok;- _bus.Invoke(new AttachContainerCommand(parent, childToAdd, insertPosition));+ _bus.Invoke(new AttachContainerCommand(childToAdd, targetParent, targetIndex));var resizableSiblings = childToAdd.SelfAndSiblings.Where(container => container is IResizable);double defaultPercent = 1.0 / resizableSiblings.Count();diff --git a/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.csindex d642cfbc..5bbb919a 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/AttachContainerHandler.cs@@ -6,29 +6,27 @@ namespace GlazeWM.Domain.Containers.CommandHandlers{class AttachContainerHandler : ICommandHandler<AttachContainerCommand>{- private Bus _bus;private ContainerService _containerService;- public AttachContainerHandler(Bus bus, ContainerService containerService)+ public AttachContainerHandler(ContainerService containerService){- _bus = bus;_containerService = containerService;}public CommandResponse Handle(AttachContainerCommand command){- var parent = command.Parent;var childToAdd = command.ChildToAdd;+ var targetParent = command.TargetParent;+ var targetIndex = command.TargetIndex;if (childToAdd.Parent != null)- throw new Exception("Attempting to attach an already attached container. This is a bug.");+ throw new Exception("Cannot attach an already attached container. This is a bug.");// TODO: Insert at end of parent's `ChildFocusOrder`.- parent.Children.Insert(command.InsertPosition, childToAdd);- childToAdd.Parent = parent;-- _containerService.ContainersToRedraw.Add(parent);+ targetParent.Children.Insert(targetIndex, childToAdd);+ childToAdd.Parent = targetParent;+ _containerService.ContainersToRedraw.Add(targetParent);return CommandResponse.Ok;}diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.csindex 125972ad..758c6584 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/ChangeContainerLayoutHandler.cs@@ -67,10 +67,10 @@ namespace GlazeWM.Domain.Containers.CommandHandlers// Replace the window with the wrapping split container. The window has to be attached to// the split container after the replacement.- _bus.Invoke(new ReplaceContainerCommand(parent, window.Index, splitContainer));+ _bus.Invoke(new ReplaceContainerCommand(splitContainer, parent, window.Index));_bus.Invoke(new DetachAndResizeContainerCommand(window));- _bus.Invoke(new AttachAndResizeContainerCommand(splitContainer, window));+ _bus.Invoke(new AttachAndResizeContainerCommand(window, splitContainer));}private void ChangeWorkspaceLayout(Workspace workspace, Layout newLayout)diff --git a/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.csindex 2726fc9a..40d710ad 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/DetachContainerHandler.cs@@ -22,7 +22,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlersvar parent = childToRemove.Parent;if (parent == null)- throw new Exception("Attempting to detach an already detached container. This is a bug.");+ throw new Exception("Cannot detach an already detached container. This is a bug.");childToRemove.Parent = null;parent.Children.Remove(childToRemove);diff --git a/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.csindex 69ae8456..68bea860 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/FlattenSplitContainerHandler.cs@@ -32,7 +32,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlers// Insert children of the split container at its original index in the parent. The split// container will automatically detach once its last child is detached._bus.Invoke(new DetachContainerCommand(child));- _bus.Invoke(new AttachContainerCommand(originalParent, child, originalIndex + index));+ _bus.Invoke(new AttachContainerCommand(child, originalParent, originalIndex + index));(child as IResizable).SizePercentage = (containerToFlatten as IResizable).SizePercentage* (child as IResizable).SizePercentage;diff --git a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.csindex b08f3e8e..67012c78 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/MoveContainerWithinTreeHandler.cs@@ -19,53 +19,58 @@ namespace GlazeWM.Domain.Containers.CommandHandlerspublic CommandResponse Handle(MoveContainerWithinTreeCommand command){- var container = command.Container;+ var containerToMove = command.ContainerToMove;var targetParent = command.TargetParent;var targetIndex = command.TargetIndex;var containerAtTargetIndex = targetParent.Children.ElementAtOrDefault(targetIndex);- if (targetParent == container.Parent && containerAtTargetIndex != null)+ if (targetParent == containerToMove.Parent && containerAtTargetIndex != null){- SwapSiblingContainers(container, containerAtTargetIndex);+ SwapSiblingContainers(containerToMove, containerAtTargetIndex);return CommandResponse.Ok;}- // Get lowest common ancestor (LCA) between `container` and `targetParent`. This could be the- // `targetParent` itself.- var lowestCommonAncestor = _containerService.GetLowestCommonAncestor(container, targetParent);+ // Get lowest common ancestor (LCA) between `containerToMove` and `targetParent`. This could+ // be the `targetParent` itself.+ var lowestCommonAncestor = _containerService.GetLowestCommonAncestor(+ containerToMove,+ targetParent+ );+ // Handle case where target parent is the LCA (eg. in the case of swapping sibling containers+ // or moving a container to a direct ancestor).if (targetParent == lowestCommonAncestor){- MoveToLowestCommonAncestor(container, lowestCommonAncestor, targetIndex);+ MoveToLowestCommonAncestor(containerToMove, lowestCommonAncestor, targetIndex);return CommandResponse.Ok;}- // Get ancestors of `container` and `targetParent` that are direct children of the LCA. This- // could be the `container` or `targetParent` itself.- var containerAncestor = container.SelfAndAncestors+ // Get ancestors of `containerToMove` and `targetParent` that are direct children of the LCA.+ // This could be the `containerToMove` or `targetParent` itself.+ var containerToMoveAncestor = containerToMove.SelfAndAncestors.First(ancestor => ancestor.Parent == lowestCommonAncestor);// Get whether the container is the focused descendant in its original subtree.- var isFocusedDescendant = container == containerAncestor- ? true : containerAncestor.LastFocusedDescendant == container;+ var isFocusedDescendant = containerToMove == containerToMoveAncestor+ ? true : containerToMoveAncestor.LastFocusedDescendant == containerToMove;var targetParentAncestor = targetParent.SelfAndAncestors.First(ancestor => ancestor.Parent == lowestCommonAncestor);- // Get whether the ancestor of `container` appears before `targetParent`'s ancestor in the- // `ChildFocusOrder` of LCA.- var originalFocusIndex = containerAncestor.FocusIndex;+ // Get whether the ancestor of `containerToMove` appears before `targetParent`'s ancestor in+ // the `ChildFocusOrder` of LCA.+ var originalFocusIndex = containerToMoveAncestor.FocusIndex;var isSubtreeFocused = originalFocusIndex < targetParentAncestor.FocusIndex;- _bus.Invoke(new DetachAndResizeContainerCommand(container));+ _bus.Invoke(new DetachAndResizeContainerCommand(containerToMove));- _bus.Invoke(new AttachAndResizeContainerCommand(targetParent, container, targetIndex));+ _bus.Invoke(new AttachAndResizeContainerCommand(containerToMove, targetParent, targetIndex));- // Set `container` as focused descendant within target subtree if its original subtree had- // focus more recently (even if the container is not the last focused within that subtree).+ // Set `containerToMove` as focused descendant within target subtree if its original subtree+ // had focus more recently (even if the container is not the last focused within that subtree).if (isSubtreeFocused)- _bus.Invoke(new SetFocusedDescendantCommand(container, targetParentAncestor));+ _bus.Invoke(new SetFocusedDescendantCommand(containerToMove, targetParentAncestor));// If the focused descendant is moved to the targets subtree, then the target's ancestor// should be placed before the original ancestor in LCA's `ChildFocusOrder`.@@ -86,7 +91,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlersprivate void SwapSiblingContainers(Container firstContainer, Container secondContainer){if (firstContainer.Parent != secondContainer.Parent)- throw new Exception("Attempting to swap containers with different parents. This is a bug.");+ throw new Exception("Cannot swap containers with different parents. This is a bug.");// Keep references to the original indices.var firstContainerIndex = firstContainer.Index;@@ -101,18 +106,18 @@ namespace GlazeWM.Domain.Containers.CommandHandlers_containerService.ContainersToRedraw.Add(targetParent);}- private void MoveToLowestCommonAncestor(Container container, Container lowestCommonAncestor, int targetIndex)+ private void MoveToLowestCommonAncestor(Container containerToMove, Container lowestCommonAncestor, int targetIndex){// Keep reference to focus index of container's ancestor in LCA's `ChildFocusOrder`.- var originalFocusIndex = container.SelfAndAncestors+ var originalFocusIndex = containerToMove.SelfAndAncestors.First(ancestor => ancestor.Parent == lowestCommonAncestor).FocusIndex;// Keep reference to container index and number of children that LCA has.- var originalIndex = container.Index;+ var originalIndex = containerToMove.Index;var originalLcaChildCount = lowestCommonAncestor.Children.Count;- _bus.Invoke(new DetachAndResizeContainerCommand(container));+ _bus.Invoke(new DetachAndResizeContainerCommand(containerToMove));var newLcaChildCount = lowestCommonAncestor.Children.Count;var shouldAdjustTargetIndex = originalLcaChildCount > newLcaChildCount@@ -122,9 +127,9 @@ namespace GlazeWM.Domain.Containers.CommandHandlers// top-level container to the right in a workspace.var adjustedTargetIndex = shouldAdjustTargetIndex ? targetIndex - 1 : targetIndex;- _bus.Invoke(new AttachAndResizeContainerCommand(lowestCommonAncestor, container, adjustedTargetIndex));+ _bus.Invoke(new AttachAndResizeContainerCommand(containerToMove, lowestCommonAncestor, adjustedTargetIndex));- lowestCommonAncestor.ChildFocusOrder.ShiftToIndex(originalFocusIndex, container);+ lowestCommonAncestor.ChildFocusOrder.ShiftToIndex(originalFocusIndex, containerToMove);}}}diff --git a/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.csindex 79382aea..ccda1b03 100644--- a/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs+++ b/GlazeWM.Domain/Containers/CommandHandlers/ReplaceContainerHandler.cs@@ -1,4 +1,5 @@-using GlazeWM.Domain.Containers.Commands;+using System;+using GlazeWM.Domain.Containers.Commands;using GlazeWM.Infrastructure.Bussing;using GlazeWM.Infrastructure.Utils;@@ -6,40 +7,38 @@ namespace GlazeWM.Domain.Containers.CommandHandlers{class ReplaceContainerHandler : ICommandHandler<ReplaceContainerCommand>{- private Bus _bus;private ContainerService _containerService;- public ReplaceContainerHandler(Bus bus, ContainerService containerService)+ public ReplaceContainerHandler(ContainerService containerService){- _bus = bus;_containerService = containerService;}public CommandResponse Handle(ReplaceContainerCommand command){- var parentContainer = command.ParentContainer;var replacementContainer = command.ReplacementContainer;- var childIndex = command.ChildIndex;+ var targetParent = command.TargetParent;+ var targetIndex = command.TargetIndex;- // Detach `ReplacementContainer` if it already has a parent.if (replacementContainer.Parent != null)- _bus.Invoke(new DetachContainerCommand(replacementContainer));+ throw new Exception(+ "Cannot use an already attached container as replacement container. This is a bug."+ );- var containerToReplace = parentContainer.Children[childIndex];+ var containerToReplace = targetParent.Children[targetIndex];// Replace the container at the given index.- parentContainer.Children.Replace(containerToReplace, replacementContainer);- replacementContainer.Parent = parentContainer;+ targetParent.Children.Replace(containerToReplace, replacementContainer);+ replacementContainer.Parent = targetParent;if (replacementContainer is IResizable && containerToReplace is IResizable)(replacementContainer as IResizable).SizePercentage =(containerToReplace as IResizable).SizePercentage;// Correct any focus order references to the replaced container.- parentContainer.ChildFocusOrder.Replace(containerToReplace, replacementContainer);+ targetParent.ChildFocusOrder.Replace(containerToReplace, replacementContainer);- _containerService.ContainersToRedraw.Add(parentContainer);- _containerService.ContainersToRedraw.Add(replacementContainer.Parent);+ _containerService.ContainersToRedraw.Add(targetParent);return CommandResponse.Ok;}diff --git a/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.csindex 3709e6a9..ab8ca6dd 100644--- a/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs+++ b/GlazeWM.Domain/Containers/Commands/AttachAndResizeContainerCommand.cs@@ -4,23 +4,23 @@ namespace GlazeWM.Domain.Containers.Commands{public class AttachAndResizeContainerCommand : Command{- public Container Parent { get; }public Container ChildToAdd { get; }- public int InsertPosition { get; }+ public Container TargetParent { get; }+ public int TargetIndex { get; }- // Insert child as end element if `insertPosition` is not provided.- public AttachAndResizeContainerCommand(Container parent, Container childToAdd)+ // Insert child as end element if `targetIndex` is not provided.+ public AttachAndResizeContainerCommand(Container childToAdd, Container targetParent){- Parent = parent;ChildToAdd = childToAdd;- InsertPosition = parent.Children.Count;+ TargetParent = targetParent;+ TargetIndex = targetParent.Children.Count;}- public AttachAndResizeContainerCommand(Container parent, Container childToAdd, int insertPosition)+ public AttachAndResizeContainerCommand(Container childToAdd, Container targetParent, int targetIndex){- Parent = parent;ChildToAdd = childToAdd;- InsertPosition = insertPosition;+ TargetParent = targetParent;+ TargetIndex = targetIndex;}}}diff --git a/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.csindex caca9381..e17e83de 100644--- a/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs+++ b/GlazeWM.Domain/Containers/Commands/AttachContainerCommand.cs@@ -4,23 +4,23 @@ namespace GlazeWM.Domain.Containers.Commands{public class AttachContainerCommand : Command{- public Container Parent { get; }public Container ChildToAdd { get; }- public int InsertPosition { get; }+ public Container TargetParent { get; }+ public int TargetIndex { get; }- // Insert child as end element if `insertPosition` is not provided.- public AttachContainerCommand(Container parent, Container childToAdd)+ // Insert child as end element if `targetIndex` is not provided.+ public AttachContainerCommand(Container childToAdd, Container targetParent){- Parent = parent;ChildToAdd = childToAdd;- InsertPosition = parent.Children.Count;+ TargetParent = targetParent;+ TargetIndex = targetParent.Children.Count;}- public AttachContainerCommand(Container parent, Container childToAdd, int insertPosition)+ public AttachContainerCommand(Container childToAdd, Container targetParent, int targetIndex){- Parent = parent;ChildToAdd = childToAdd;- InsertPosition = insertPosition;+ TargetParent = targetParent;+ TargetIndex = targetIndex;}}}diff --git a/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs b/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.csindex ea96e78d..a4de6460 100644--- a/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs+++ b/GlazeWM.Domain/Containers/Commands/MoveContainerWithinTreeCommand.cs@@ -4,21 +4,21 @@ namespace GlazeWM.Domain.Containers.Commands{public class MoveContainerWithinTreeCommand : Command{- public Container Container { get; }+ public Container ContainerToMove { get; }public Container TargetParent { get; }public int TargetIndex { get; }// Insert child as end element if `targetIndex` is not provided.- public MoveContainerWithinTreeCommand(Container container, Container targetParent)+ public MoveContainerWithinTreeCommand(Container containerToMove, Container targetParent){- Container = container;+ ContainerToMove = containerToMove;TargetParent = targetParent;TargetIndex = targetParent.Children.Count;}- public MoveContainerWithinTreeCommand(Container container, Container targetParent, int targetIndex)+ public MoveContainerWithinTreeCommand(Container containerToMove, Container targetParent, int targetIndex){- Container = container;+ ContainerToMove = containerToMove;TargetParent = targetParent;TargetIndex = targetIndex;}diff --git a/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs b/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.csindex 47ad3978..531f87bf 100644--- a/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs+++ b/GlazeWM.Domain/Containers/Commands/ReplaceContainerCommand.cs@@ -4,15 +4,15 @@ namespace GlazeWM.Domain.Containers.Commands{public class ReplaceContainerCommand : Command{- public Container ParentContainer { get; }- public int ChildIndex { get; }public Container ReplacementContainer { get; }+ public Container TargetParent { get; }+ public int TargetIndex { get; }- public ReplaceContainerCommand(Container parentContainer, int childIndex, Container replacementContainer)+ public ReplaceContainerCommand(Container replacementContainer, Container targetParent, int targetIndex){- ParentContainer = parentContainer;- ChildIndex = childIndex;ReplacementContainer = replacementContainer;+ TargetParent = targetParent;+ TargetIndex = targetIndex;}}}diff --git a/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs b/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.csindex 4b501d93..ec5fab94 100644--- a/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs+++ b/GlazeWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs@@ -27,7 +27,7 @@ namespace GlazeWM.Domain.Monitors.CommandHandlersvar newMonitor = new Monitor(command.Screen);var rootContainer = _containerService.ContainerTree;- _bus.Invoke(new AttachContainerCommand(rootContainer, newMonitor));+ _bus.Invoke(new AttachContainerCommand(newMonitor, rootContainer));ActivateWorkspaceOnMonitor(newMonitor);diff --git a/GlazeWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/AddWindowHandler.csindex 003b31e2..e12185c0 100644--- a/GlazeWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs+++ b/GlazeWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs@@ -97,7 +97,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlers{if (targetParent != null){- _bus.Invoke(new AttachAndResizeContainerCommand(targetParent, window));+ _bus.Invoke(new AttachAndResizeContainerCommand(window, targetParent));return;}@@ -106,14 +106,14 @@ namespace GlazeWM.Domain.Windows.CommandHandlers// If the focused container is a workspace, attach the window as a child of the workspace.if (focusedContainer is Workspace){- _bus.Invoke(new AttachAndResizeContainerCommand(focusedContainer, window));+ _bus.Invoke(new AttachAndResizeContainerCommand(window, focusedContainer));return;}// Attach the window as a sibling next to the focused window._bus.Invoke(new AttachAndResizeContainerCommand(- focusedContainer.Parent,window,+ focusedContainer.Parent,focusedContainer.Index + 1));}diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.csindex b375b86b..252308fe 100644--- a/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs+++ b/GlazeWM.Domain/Windows/CommandHandlers/ToggleFloatingHandler.cs@@ -48,7 +48,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlersworkspace.Y + (workspace.Height / 2) - (window.OriginalHeight / 2));- _bus.Invoke(new ReplaceContainerCommand(window.Parent, window.Index, floatingWindow));+ _bus.Invoke(new ReplaceContainerCommand(floatingWindow, window.Parent, window.Index));_bus.Invoke(new MoveContainerWithinTreeCommand(floatingWindow, workspace));_bus.Invoke(new RedrawContainersCommand());@@ -67,7 +67,7 @@ namespace GlazeWM.Domain.Windows.CommandHandlersvar insertionTarget = workspace.LastFocusedDescendantOfType(typeof(IResizable));var tilingWindow = new TilingWindow(floatingWindow.Hwnd, originalWidth, originalHeight);- _bus.Invoke(new ReplaceContainerCommand(floatingWindow.Parent, floatingWindow.Index, tilingWindow));+ _bus.Invoke(new ReplaceContainerCommand(tilingWindow, floatingWindow.Parent, floatingWindow.Index));// Insert the created tiling window after the last focused descendant of the workspace.if (insertionTarget == null)diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.csindex aca964d1..9b747a10 100644--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs@@ -31,7 +31,7 @@ namespace GlazeWM.Domain.Windows.EventHandlersreturn;var tilingWindow = new TilingWindow(window.Hwnd, window.OriginalWidth, window.OriginalHeight);- _bus.Invoke(new ReplaceContainerCommand(window.Parent, window.Index, tilingWindow));+ _bus.Invoke(new ReplaceContainerCommand(tilingWindow, window.Parent, window.Index));// Keep reference to the window's ancestor workspace prior to detaching.var workspace = _workspaceService.GetWorkspaceFromChildContainer(window);diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.csindex 1af5ef67..d1cb04c1 100644--- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs@@ -41,7 +41,7 @@ namespace GlazeWM.Domain.Windows.EventHandlers// Keep reference to the window's ancestor workspace and focus order index prior to detaching.var workspace = _workspaceService.GetWorkspaceFromChildContainer(window);- _bus.Invoke(new ReplaceContainerCommand(window.Parent, window.Index, minimizedWindow));+ _bus.Invoke(new ReplaceContainerCommand(minimizedWindow, window.Parent, window.Index));_bus.Invoke(new MoveContainerWithinTreeCommand(minimizedWindow, workspace));var containerToFocus = workspace.LastFocusedDescendant ?? workspace;diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/AttachWorkspaceToMonitorHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/AttachWorkspaceToMonitorHandler.csindex 66a6edae..a2689522 100644--- a/GlazeWM.Domain/Workspaces/CommandHandlers/AttachWorkspaceToMonitorHandler.cs+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/AttachWorkspaceToMonitorHandler.cs@@ -21,7 +21,7 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlersvar monitor = command.Monitor;var workspace = command.Workspace;- _bus.Invoke(new AttachContainerCommand(monitor, workspace));+ _bus.Invoke(new AttachContainerCommand(workspace, monitor));_workspaceService.InactiveWorkspaces.Remove(command.Workspace);_bus.RaiseEvent(new WorkspaceAttachedEvent(command.Workspace));