mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
speedup auto-restore-new-window, reduce killed window entry by wild matching non-resizable window which will not be restored
This commit is contained in:
parent
f05d569387
commit
5d26d86e28
1 changed files with 8 additions and 29 deletions
|
@ -1486,8 +1486,6 @@ namespace PersistentWindows.Common
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(className))
|
if (!string.IsNullOrEmpty(className))
|
||||||
{
|
{
|
||||||
int title_match_cnt = 0;
|
|
||||||
IntPtr title_match_hid = IntPtr.Zero;
|
|
||||||
int pos_match_cnt = 0;
|
int pos_match_cnt = 0;
|
||||||
IntPtr pos_match_hid = IntPtr.Zero;
|
IntPtr pos_match_hid = IntPtr.Zero;
|
||||||
int similar_pos_cnt = 0;
|
int similar_pos_cnt = 0;
|
||||||
|
@ -1521,7 +1519,6 @@ namespace PersistentWindows.Common
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IsMinimized(hwnd) != appPos.IsMinimized)
|
if (IsMinimized(hwnd) != appPos.IsMinimized)
|
||||||
continue;
|
continue;
|
||||||
if (User32.IsWindowVisible(hwnd) == appPos.IsInvisible)
|
if (User32.IsWindowVisible(hwnd) == appPos.IsInvisible)
|
||||||
|
@ -1534,12 +1531,6 @@ namespace PersistentWindows.Common
|
||||||
if (rect.Equals(r) && title.Equals(appPos.Title))
|
if (rect.Equals(r) && title.Equals(appPos.Title))
|
||||||
return kid;
|
return kid;
|
||||||
|
|
||||||
if (title.Equals(appPos.Title))
|
|
||||||
{
|
|
||||||
title_match_hid = kid;
|
|
||||||
++title_match_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rect.Equals(r))
|
if (rect.Equals(r))
|
||||||
{
|
{
|
||||||
pos_match_cnt++;
|
pos_match_cnt++;
|
||||||
|
@ -1569,13 +1560,9 @@ namespace PersistentWindows.Common
|
||||||
return similar_pos_hid;
|
return similar_pos_hid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (!IsResizableWindow(hwnd))
|
||||||
if (title_match_cnt == 1)
|
return similar_pos_hid;
|
||||||
{
|
|
||||||
Log.Event($"matching window with same title");
|
|
||||||
return title_match_hid;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (!monitorApplications.ContainsKey(curDisplayKey))
|
if (!monitorApplications.ContainsKey(curDisplayKey))
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
|
||||||
|
@ -1586,9 +1573,9 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
foreach (var dm in monitorApplications[curDisplayKey][h])
|
foreach (var dm in monitorApplications[curDisplayKey][h])
|
||||||
{
|
{
|
||||||
if (IsMinimized(h) != dm.IsMinimized)
|
if (style != dm.Style && dm.Style != 0)
|
||||||
continue;
|
continue;
|
||||||
if (User32.IsWindowVisible(h) == dm.IsInvisible)
|
if (ext_style != dm.ExtStyle && dm.ExtStyle != 0)
|
||||||
continue;
|
continue;
|
||||||
if (dm.ProcessName == procName)
|
if (dm.ProcessName == procName)
|
||||||
{
|
{
|
||||||
|
@ -2141,24 +2128,14 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
case User32Events.EVENT_OBJECT_CREATE:
|
case User32Events.EVENT_OBJECT_CREATE:
|
||||||
{
|
{
|
||||||
if (idObject != 0)
|
|
||||||
// ignore non-window object (caret etc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (restoringFromDB)
|
if (restoringFromDB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (freezeCapture || !monitorApplications.ContainsKey(curDisplayKey))
|
if (freezeCapture || !monitorApplications.ContainsKey(curDisplayKey))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
//try to inherit from killed window database
|
|
||||||
if (FindMatchingKilledWindow(hwnd) != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
userMove = true;
|
userMove = true;
|
||||||
StartCaptureTimer(UserMoveLatency * 4);
|
StartCaptureTimer(UserMoveLatency / 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3241,6 +3218,8 @@ namespace PersistentWindows.Common
|
||||||
restoringFromMem = true;
|
restoringFromMem = true;
|
||||||
RestoreApplicationsOnCurrentDisplays(curDisplayKey, hwnd, prevDisplayMetrics.CaptureTime);
|
RestoreApplicationsOnCurrentDisplays(curDisplayKey, hwnd, prevDisplayMetrics.CaptureTime);
|
||||||
restoringFromMem = false;
|
restoringFromMem = false;
|
||||||
|
userMove = true;
|
||||||
|
StartCaptureTimer(UserMoveLatency / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue