mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 21:15:38 +02:00
issue #224: new command option -accurate_taskbar_minimized_window=1, default off
This commit is contained in:
parent
285b64b606
commit
1c27d4439c
2 changed files with 22 additions and 8 deletions
|
@ -100,6 +100,7 @@ namespace PersistentWindows.Common
|
|||
public bool enableOffScreenFix = true;
|
||||
public bool enhancedOffScreenFix = false;
|
||||
public bool fixUnminimizedWindow = true;
|
||||
public bool accurateTaskbarMinimizedWindow = false;
|
||||
public bool autoRestoreMissingWindows = false;
|
||||
public bool launchOncePerProcessId = true;
|
||||
private int restoreTimes = 0; //multiple passes need to fully restore
|
||||
|
@ -2326,7 +2327,10 @@ namespace PersistentWindows.Common
|
|||
else if (curDisplayMetrics.IsMinimized && prevDisplayMetrics.IsMinimized)
|
||||
{
|
||||
//remain minimized
|
||||
return false;
|
||||
if (!accurateTaskbarMinimizedWindow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!prevDisplayMetrics.EqualPlacement(curDisplayMetrics))
|
||||
|
@ -3034,14 +3038,21 @@ namespace PersistentWindows.Common
|
|||
{
|
||||
if (prevDisplayMetrics.IsMinimized)
|
||||
{
|
||||
// first try to minimize
|
||||
User32.ShowWindow(hWnd, User32.SW_SHOWMINNOACTIVE);
|
||||
if (accurateTaskbarMinimizedWindow && restoreTimes == 0)
|
||||
{
|
||||
//restore normal position first
|
||||
}
|
||||
else
|
||||
{
|
||||
// first try to minimize
|
||||
User32.ShowWindow(hWnd, User32.SW_SHOWMINNOACTIVE);
|
||||
|
||||
// second try
|
||||
if (!IsMinimized(hWnd))
|
||||
User32.SendMessage(hWnd, User32.WM_SYSCOMMAND, User32.SC_MINIMIZE, IntPtr.Zero);
|
||||
Log.Error("keep minimized window {0}", GetWindowTitle(hWnd));
|
||||
continue;
|
||||
// second try
|
||||
if (!IsMinimized(hWnd))
|
||||
User32.SendMessage(hWnd, User32.WM_SYSCOMMAND, User32.SC_MINIMIZE, IntPtr.Zero);
|
||||
Log.Error("keep minimized window {0}", GetWindowTitle(hWnd));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,6 +162,9 @@ namespace PersistentWindows.SystrayShell
|
|||
case "-fix_unminimized_window=0":
|
||||
fix_unminimized_window = false;
|
||||
break;
|
||||
case "-accurate_taskbar_minimized_window=1":
|
||||
pwp.accurateTaskbarMinimizedWindow = true;
|
||||
break;
|
||||
case "-prompt_session_restore":
|
||||
prompt_session_restore = true;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue