From 05a740a21f1ac4125262085cdb227586262c8063 Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Wed, 19 Mar 2025 15:35:44 -0700 Subject: [PATCH] unlock unknown display session when any window is moved/resized/minimize/unminimized --- .../Common/PersistentWindowProcessor.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs index 223aa03..46a978a 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs @@ -2120,6 +2120,12 @@ namespace PersistentWindows.Common break; case User32Events.EVENT_SYSTEM_MOVESIZESTART: + if (freezeCapture) + { + Log.Event($"recognize {curDisplayKey} as user session"); + freezeCapture = false; //unlock unknown display session as normal + } + if ((User32.GetKeyState(0x11) & 0x8000) != 0 //ctrl key pressed && (User32.GetKeyState(0x10) & 0x8000) != 0) //shift key pressed { @@ -2133,6 +2139,12 @@ namespace PersistentWindows.Common lastUnminimizeWindow = hwnd; tidyTabWindows.Remove(hwnd); //no longer hidden by tidytab + if (freezeCapture) + { + Log.Event($"recognize {curDisplayKey} as user session"); + freezeCapture = false; //unlock unknown display session as normal + } + if (monitorApplications.ContainsKey(curDisplayKey) && monitorApplications[curDisplayKey].ContainsKey(hwnd)) { //treat unminimized window as foreground @@ -2161,6 +2173,12 @@ namespace PersistentWindows.Common if (enableMinimizeToTray) MinimizeToTray.Create(hwnd); + if (freezeCapture) + { + Log.Event($"recognize {curDisplayKey} as user session"); + freezeCapture = false; //unlock unknown display session as normal + } + goto case User32Events.EVENT_SYSTEM_MOVESIZEEND; case User32Events.EVENT_SYSTEM_MOVESIZEEND: if (eventType == User32Events.EVENT_SYSTEM_MOVESIZEEND)