#356, matching window title has higher priority than matching window position when inherit from killed window

This commit is contained in:
Kang Yu 2024-10-10 12:28:03 -07:00
parent c8575c1b03
commit df594f6045

View file

@ -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;
}