GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
refactor(domain): remove unused `SwapContainersCommand` and its handler
Lars Berger5f2fa4933d1c
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/SwapContainersHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/SwapContainersHandler.csdeleted file mode 100644index 251d6f46..00000000--- a/GlazeWM.Domain/Containers/CommandHandlers/SwapContainersHandler.cs+++ /dev/null@@ -1,39 +0,0 @@-using System;-using GlazeWM.Domain.Containers.Commands;-using GlazeWM.Infrastructure.Bussing;--namespace GlazeWM.Domain.Containers.CommandHandlers-{- class SwapContainersHandler : ICommandHandler<SwapContainersCommand>- {- private ContainerService _containerService;-- public SwapContainersHandler(ContainerService containerService)- {- _containerService = containerService;- }-- public CommandResponse Handle(SwapContainersCommand command)- {- var firstContainer = command.FirstContainer;- var secondContainer = command.SecondContainer;-- if (firstContainer.Parent != secondContainer.Parent)- throw new Exception("Attempting to swap containers with different parents. This is a bug.");-- // Keep references to the original indices.- var firstContainerIndex = firstContainer.Index;- var secondContainerIndex = secondContainer.Index;-- // Swap the containers. Note that using the parent of the first container is arbitrary since- // both containers have the same parent.- var parent = firstContainer.Parent;- parent.Children[firstContainerIndex] = secondContainer;- parent.Children[secondContainerIndex] = firstContainer;-- _containerService.ContainersToRedraw.Add(parent);-- return CommandResponse.Ok;- }- }-}diff --git a/GlazeWM.Domain/Containers/Commands/SwapContainersCommand.cs b/GlazeWM.Domain/Containers/Commands/SwapContainersCommand.csdeleted file mode 100644index 41333f47..00000000--- a/GlazeWM.Domain/Containers/Commands/SwapContainersCommand.cs+++ /dev/null@@ -1,16 +0,0 @@-using GlazeWM.Infrastructure.Bussing;--namespace GlazeWM.Domain.Containers.Commands-{- public class SwapContainersCommand : Command- {- public Container FirstContainer { get; }- public Container SecondContainer { get; }-- public SwapContainersCommand(Container firstContainer, Container secondContainer)- {- FirstContainer = firstContainer;- SecondContainer = secondContainer;- }- }-}diff --git a/GlazeWM.Domain/DependencyInjection.cs b/GlazeWM.Domain/DependencyInjection.csindex e474d86a..b74ff782 100644--- a/GlazeWM.Domain/DependencyInjection.cs+++ b/GlazeWM.Domain/DependencyInjection.cs@@ -41,7 +41,6 @@ namespace GlazeWM.Domainservices.AddTransient<ICommandHandler<RedrawContainersCommand>, RedrawContainersHandler>();services.AddTransient<ICommandHandler<ReplaceContainerCommand>, ReplaceContainerHandler>();services.AddTransient<ICommandHandler<SetFocusedDescendantCommand>, SetFocusedDescendantHandler>();- services.AddTransient<ICommandHandler<SwapContainersCommand>, SwapContainersHandler>();services.AddTransient<ICommandHandler<ToggleFocusModeCommand>, ToggleFocusModeHandler>();services.AddTransient<ICommandHandler<AddMonitorCommand>, AddMonitorHandler>();services.AddTransient<ICommandHandler<EvaluateUserConfigCommand>, EvaluateUserConfigHandler>();