From 5bc3f681cb14187c4a2953087b5e38a062fa47ef Mon Sep 17 00:00:00 2001 From: Lars Berger Date: Wed, 13 Sep 2023 23:19:15 +0800 Subject: [PATCH] feat: sync focus at end of window destroyed, hidden, and minimized --- GlazeWM.Domain/Containers/ContainerService.cs | 2 +- GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs | 1 + GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs | 1 + GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/GlazeWM.Domain/Containers/ContainerService.cs b/GlazeWM.Domain/Containers/ContainerService.cs index bf625e0e4..e7b68ed0d 100644 --- a/GlazeWM.Domain/Containers/ContainerService.cs +++ b/GlazeWM.Domain/Containers/ContainerService.cs @@ -29,7 +29,7 @@ public class ContainerService public Container FocusedContainer => ContainerTree.LastFocusedDescendant; /// - /// Whether native focus will need to be reassigned to the WM's focused container. + /// Whether native focus needs to be reassigned to `FocusedContainer`. /// public bool HasPendingFocusSync { get; set; } diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs index 2c318b517..63cc3857e 100644 --- a/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs +++ b/GlazeWM.Domain/Windows/EventHandlers/WindowDestroyedHandler.cs @@ -47,6 +47,7 @@ public void Handle(WindowDestroyedEvent @event) // If window is in tree, detach the removed window from its parent. _bus.Invoke(new UnmanageWindowCommand(window)); _bus.Invoke(new RedrawContainersCommand()); + _bus.Invoke(new SyncNativeFocusCommand()); } } } diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs index 47c36430c..e7db591a0 100644 --- a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs +++ b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs @@ -50,6 +50,7 @@ public void Handle(WindowHiddenEvent @event) // Detach the hidden window from its parent. _bus.Invoke(new UnmanageWindowCommand(window)); _bus.Invoke(new RedrawContainersCommand()); + _bus.Invoke(new SyncNativeFocusCommand()); } } } diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs index ff13552eb..0ebd81cf0 100644 --- a/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs +++ b/GlazeWM.Domain/Windows/EventHandlers/WindowMinimizedHandler.cs @@ -66,6 +66,7 @@ public void Handle(WindowMinimizedEvent @event) _containerService.ContainersToRedraw.Add(workspace); _bus.Invoke(new RedrawContainersCommand()); + _bus.Invoke(new SyncNativeFocusCommand()); } } }