GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): create event handlers for minimize/minimize end (partially implemented)
Lars Bergerfafc60c3f89f
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.csnew file mode 100644index 00000000..1e6b280d--- /dev/null+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizeEndedHandler.cs@@ -0,0 +1,37 @@+using System.Linq;+using GlazeWM.Domain.Containers;+using GlazeWM.Domain.Containers.Commands;+using GlazeWM.Infrastructure.Bussing;+using GlazeWM.Infrastructure.WindowsApi.Events;++namespace GlazeWM.Domain.Windows.EventHandlers+{+ class WindowMinimizeEndedHandler : IEventHandler<WindowMinimizeEndedEvent>+ {+ private Bus _bus;+ private WindowService _windowService;+ private ContainerService _containerService;++ public WindowMinimizeEndedHandler(Bus bus, WindowService windowService, ContainerService containerService)+ {+ _bus = bus;+ _windowService = windowService;+ _containerService = containerService;+ }++ public void Handle(WindowMinimizeEndedEvent @event)+ {+ var window = _windowService.GetWindows()+ .FirstOrDefault(window => window.Hwnd == @event.WindowHandle);++ if (window == null)+ return;++ window.Mode = WindowMode.TILING;+ window.SizePercentage = 1;++ _containerService.SplitContainersToRedraw.Add(window.Parent as SplitContainer);+ _bus.Invoke(new RedrawContainersCommand());+ }+ }+}diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.csnew file mode 100644index 00000000..0d44c1d7--- /dev/null+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs@@ -0,0 +1,37 @@+using System.Linq;+using GlazeWM.Domain.Containers;+using GlazeWM.Domain.Containers.Commands;+using GlazeWM.Infrastructure.Bussing;+using GlazeWM.Infrastructure.WindowsApi.Events;++namespace GlazeWM.Domain.Windows.EventHandlers+{+ class WindowMinimizedHandler : IEventHandler<WindowMinimizedEvent>+ {+ private Bus _bus;+ private WindowService _windowService;+ private ContainerService _containerService;++ public WindowMinimizedHandler(Bus bus, WindowService windowService, ContainerService containerService)+ {+ _bus = bus;+ _windowService = windowService;+ _containerService = containerService;+ }++ public void Handle(WindowMinimizedEvent @event)+ {+ var window = _windowService.GetWindows()+ .FirstOrDefault(window => window.Hwnd == @event.WindowHandle);++ if (window == null)+ return;++ window.Mode = WindowMode.MINIMIZED;+ window.SizePercentage = 0;++ _containerService.SplitContainersToRedraw.Add(window.Parent as SplitContainer);+ _bus.Invoke(new RedrawContainersCommand());+ }+ }+}