From 9224d621917971674e605ab6bf41f0becbf26aa0 Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Sat, 26 Apr 2025 22:55:31 -0700 Subject: [PATCH] postpone capture to avoid wrong matching to killed window --- .../Common/PersistentWindowProcessor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs index 7187d05..6c74083 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs @@ -2683,6 +2683,10 @@ namespace PersistentWindows.Common if (new_window) { + //if (windowProcessName[hWnd] == "mstsc" && curDisplayMetrics.IsMinimized && curDisplayMetrics.IsInvisible && !curDisplayMetrics.IsFullScreen) + if (curDisplayMetrics.IsMinimized && curDisplayMetrics.IsInvisible && !curDisplayMetrics.IsFullScreen) + return false; //postpone capture till window is visible + IntPtr kid = FindMatchingKilledWindow(hWnd); bool restore_last = TryInheritWindow(hWnd, curDisplayMetrics.HWnd, kid, curDisplayMetrics); if (restore_last && prevDisplayMetrics != null && !restoringFromDB && IsResizableWindow(hWnd))