add command option -foreground_background_dual_position=0 to disable smart foregroudn/backgrounding switching

This commit is contained in:
Kang Yu 2023-09-14 22:12:14 -07:00
parent 7d464fa4ab
commit 786ba0437d
2 changed files with 11 additions and 2 deletions

View file

@ -109,6 +109,7 @@ namespace PersistentWindows.Common
public int haltRestore = 3000; //milliseconds to wait to finish current halted restore and restart next one
private HashSet<IntPtr> restoredWindows = new HashSet<IntPtr>();
private HashSet<IntPtr> topmostWindowsFixed = new HashSet<IntPtr>();
public bool enableSmartForeBackground = true;
private Dictionary<string, string> realProcessFileName = new Dictionary<string, string>()
{
@ -1722,6 +1723,12 @@ namespace PersistentWindows.Common
if (hwnd == IntPtr.Zero || IsTaskBar(hwnd))
return;
if (toForeground)
ActivateWindow(hwnd);
if (!enableSmartForeBackground)
return;
if (!monitorApplications.ContainsKey(curDisplayKey) || !monitorApplications[curDisplayKey].ContainsKey(hwnd))
return;
@ -1752,11 +1759,10 @@ namespace PersistentWindows.Common
break;
}
}
restoringFromMem = true;
RestoreApplicationsOnCurrentDisplays(curDisplayKey, hwnd, metrics.CaptureTime);
restoringFromMem = false;
if (toForeground)
ActivateWindow(hwnd);
break;
}

View file

@ -164,6 +164,9 @@ namespace PersistentWindows.SystrayShell
case "-fix_unminimized_window=0":
fix_unminimized_window = false;
break;
case "-foreground_background_dual_position=0":
pwp.enableSmartForeBackground = false;
break;
case "-prompt_session_restore":
prompt_session_restore = true;
break;