mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
fix wrong assumption causing mis-capture and failure for dual position switching
This commit is contained in:
parent
021205f255
commit
ddbbe88032
1 changed files with 9 additions and 5 deletions
|
@ -77,6 +77,7 @@ namespace PersistentWindows.Common
|
|||
|
||||
// capture control
|
||||
private Timer captureTimer;
|
||||
private bool captureTimerStarted = false;
|
||||
private string curDisplayKey; // current display config name
|
||||
public string dbDisplayKey = null;
|
||||
private static Dictionary<IntPtr, string> windowTitle = new Dictionary<IntPtr, string>(); // for matching running window with DB record
|
||||
|
@ -683,6 +684,8 @@ namespace PersistentWindows.Common
|
|||
|
||||
captureTimer = new Timer(state =>
|
||||
{
|
||||
captureTimerStarted = false;
|
||||
|
||||
userMovePrev = userMove;
|
||||
userMove = false;
|
||||
|
||||
|
@ -2632,16 +2635,17 @@ namespace PersistentWindows.Common
|
|||
|
||||
private void StartCaptureTimer(int milliSeconds = CaptureLatency)
|
||||
{
|
||||
// ignore defer timer request to capture user move ASAP
|
||||
if (captureTimerStarted)
|
||||
return;
|
||||
captureTimerStarted = true;
|
||||
|
||||
if (UserForcedCaptureLatency > 0)
|
||||
{
|
||||
captureTimer.Change(UserForcedCaptureLatency, Timeout.Infinite);
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore defer timer request to capture user move ASAP
|
||||
if (userMove)
|
||||
return; //assuming timer has already started
|
||||
|
||||
// restart capture timer
|
||||
captureTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
}
|
||||
|
@ -3156,7 +3160,7 @@ namespace PersistentWindows.Common
|
|||
|
||||
if (restore_last && prevDisplayMetrics != null && !restoringFromDB)
|
||||
{
|
||||
Log.Error($"restore {windowTitle[hwnd]} to last captured position");
|
||||
Log.Trace($"restore {windowTitle[hwnd]} to last captured position");
|
||||
restoringFromMem = true;
|
||||
RestoreApplicationsOnCurrentDisplays(curDisplayKey, hwnd, prevDisplayMetrics.CaptureTime);
|
||||
restoringFromMem = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue