Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix(domain): avoid detaching windows on hide if they're actually visible

Lars Berger7b37ea98f779
diff --git a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
index c36814d9..9b7c116e 100644
--- a/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
+++ b/GlazeWM.Domain/Windows/EventHandlers/WindowHiddenHandler.cs
@@ -22,8 +22,10 @@ namespace GlazeWM.Domain.Windows.EventHandlers
var window = _windowService.GetWindows()
.FirstOrDefault(window => window.Hwnd == @event.WindowHandle);
- // Ignore cases where the window isn't managed or is actually supposed to be hidden.
- if (window == null || window.IsHidden == true)
+ // Ignore events where the window isn't managed or is actually supposed to be hidden. Since
+ // window events are processed in a sequence, also handle case where the window is not
+ // actually hidden anymore when the event is processed.
+ if (window == null || window.IsHidden == true || _windowService.IsHandleVisible(window.Hwnd))
return;
// Detach the hidden window from its parent.