use ctrl-move or ctrl-resize to activate dual position switch feature

This commit is contained in:
Kang Yu 2023-12-10 14:53:11 -08:00
parent 82fa1833d5
commit 26714e7e82
2 changed files with 13 additions and 6 deletions

View file

@ -108,7 +108,9 @@ 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 = false;
public bool enableDualPosSwitch = true;
private HashSet<IntPtr> dualPosSwitchWindows = new HashSet<IntPtr>();
private Dictionary<string, string> realProcessFileName = new Dictionary<string, string>()
{
@ -1221,6 +1223,7 @@ namespace PersistentWindows.Common
debugWindows.Remove(hwnd);
fullScreenGamingWindows.Remove(hwnd);
windowTitle.Remove(hwnd);
dualPosSwitchWindows.Remove(hwnd);
foreach (var key in monitorApplications.Keys)
{
@ -1479,6 +1482,11 @@ namespace PersistentWindows.Common
break;
case User32Events.EVENT_SYSTEM_MOVESIZESTART:
if (ctrl_key_pressed)
dualPosSwitchWindows.Add(hwnd);
else
dualPosSwitchWindows.Remove(hwnd);
curMovingWnd = hwnd;
break;
@ -1814,7 +1822,9 @@ namespace PersistentWindows.Common
if (hwnd == IntPtr.Zero || IsTaskBar(hwnd))
return;
if (!enableSmartForeBackground)
if (!enableDualPosSwitch)
return;
if (!dualPosSwitchWindows.Contains(hwnd))
return;
if (!monitorApplications.ContainsKey(curDisplayKey) || !monitorApplications[curDisplayKey].ContainsKey(hwnd))

View file

@ -165,10 +165,7 @@ namespace PersistentWindows.SystrayShell
fix_unminimized_window = false;
break;
case "-foreground_background_dual_position=0":
pwp.enableSmartForeBackground = false;
break;
case "-foreground_background_dual_position=1":
pwp.enableSmartForeBackground = true;
pwp.enableDualPosSwitch = false;
break;
case "-prompt_session_restore":
prompt_session_restore = true;