From df594f60454b97febb5160308678af559fb7616f Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Thu, 10 Oct 2024 12:28:03 -0700 Subject: [PATCH] #356, matching window title has higher priority than matching window position when inherit from killed window --- .../Common/PersistentWindowProcessor.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs index b9471f2..c0d03d2 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/PersistentWindowProcessor.cs @@ -1349,17 +1349,21 @@ namespace PersistentWindows.Common if (!procName.Equals(appPos.ProcessName)) continue; - // match position first RECT r = appPos.ScreenPosition; RECT rect = new RECT(); User32.GetWindowRect(hwnd, ref rect); - if (rect.Equals(r)) + // find exact match first + if (rect.Equals(r) && title.Equals(appPos.Title)) return kid; - // lastly match title + // match title second if (title.Equals(appPos.Title)) return kid; + // match position last + if (rect.Equals(r)) + return kid; + if (dflt_kid == IntPtr.Zero) dflt_kid = kid; }