mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-12 13:35:39 +02:00
unified RemoveInvalidCapture() usage
This commit is contained in:
parent
6cbfea8f69
commit
c5c12dcad3
1 changed files with 8 additions and 2 deletions
|
@ -1592,7 +1592,9 @@ namespace PersistentWindows.Common
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// unminimize to previous location
|
// unminimize to previous location
|
||||||
|
RemoveInvalidCapture(hwnd);
|
||||||
ApplicationDisplayMetrics prevDisplayMetrics = monitorApplications[curDisplayKey][hwnd].Last<ApplicationDisplayMetrics>();
|
ApplicationDisplayMetrics prevDisplayMetrics = monitorApplications[curDisplayKey][hwnd].Last<ApplicationDisplayMetrics>();
|
||||||
|
/*
|
||||||
var diff = prevDisplayMetrics.CaptureTime.Subtract(lastUnminimizeTime);
|
var diff = prevDisplayMetrics.CaptureTime.Subtract(lastUnminimizeTime);
|
||||||
if (diff.TotalMilliseconds > 0 && diff.TotalMilliseconds < 400)
|
if (diff.TotalMilliseconds > 0 && diff.TotalMilliseconds < 400)
|
||||||
{
|
{
|
||||||
|
@ -1610,6 +1612,7 @@ namespace PersistentWindows.Common
|
||||||
|
|
||||||
prevDisplayMetrics = lastMetrics;
|
prevDisplayMetrics = lastMetrics;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
RECT target_rect = prevDisplayMetrics.ScreenPosition;
|
RECT target_rect = prevDisplayMetrics.ScreenPosition;
|
||||||
if (prevDisplayMetrics.IsFullScreen)
|
if (prevDisplayMetrics.IsFullScreen)
|
||||||
|
@ -2139,7 +2142,7 @@ namespace PersistentWindows.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveInvalidCapture()
|
private void RemoveInvalidCapture(IntPtr h)
|
||||||
{
|
{
|
||||||
if (restoringSnapshot || restoringFromDB)
|
if (restoringSnapshot || restoringFromDB)
|
||||||
return;
|
return;
|
||||||
|
@ -2148,6 +2151,9 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
foreach (var hwnd in monitorApplications[curDisplayKey].Keys)
|
foreach (var hwnd in monitorApplications[curDisplayKey].Keys)
|
||||||
{
|
{
|
||||||
|
if (h != IntPtr.Zero && hwnd != h)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (int i = monitorApplications[curDisplayKey][hwnd].Count - 1; i >= 0; --i)
|
for (int i = monitorApplications[curDisplayKey][hwnd].Count - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (!monitorApplications[curDisplayKey][hwnd][i].IsValid)
|
if (!monitorApplications[curDisplayKey][hwnd][i].IsValid)
|
||||||
|
@ -3301,7 +3307,7 @@ namespace PersistentWindows.Common
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RemoveInvalidCapture();
|
RemoveInvalidCapture(IntPtr.Zero);
|
||||||
extra_restore = RestoreApplicationsOnCurrentDisplays(displayKey, IntPtr.Zero, DateTime.Now);
|
extra_restore = RestoreApplicationsOnCurrentDisplays(displayKey, IntPtr.Zero, DateTime.Now);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue