new feature: ctrl alt click pw icon to bring current foreground window to bottom

This commit is contained in:
Kang Yu 2023-08-07 18:46:15 -07:00
parent cf7bc24013
commit 3b7592e1cc
3 changed files with 26 additions and 2 deletions

View file

@ -1685,6 +1685,22 @@ namespace PersistentWindows.Common
return fixZorder == 2 || (restoringSnapshot && fixZorder > 0);
}
public void FgWindowToBottom()
{
IntPtr hwnd = prevForegroundWindow;
if (hwnd == IntPtr.Zero || IsTaskBar(hwnd))
return;
User32.SetWindowPos(hwnd, new IntPtr(1), //bottom
0, 0, 0, 0,
0
| SetWindowPosFlags.DoNotActivate
| SetWindowPosFlags.IgnoreMove
| SetWindowPosFlags.IgnoreResize
);
Log.Event("Bring foreground window {0} to bottom", GetWindowTitle(hwnd));
}
public void BringForegroundToBackground()
{
//IntPtr hwnd = foreGroundWindow[curDisplayKey];

View file

@ -543,6 +543,11 @@ namespace PersistentWindows.SystrayShell
pwp.BringForegroundToBackground();
}
static public void FgWindowToBottom()
{
pwp.FgWindowToBottom();
}
static public void PauseAutoRestore()
{
pwp.pauseAutoRestore = true;

View file

@ -100,7 +100,7 @@ namespace PersistentWindows.SystrayShell
{
//no more than one key can be pressed
}
else if (altKeyPressed == clickCount && altKeyPressed != 0)
else if (altKeyPressed == clickCount && altKeyPressed != 0 && ctrlKeyPressed == 0)
{
//restore previous workspace (not necessarily a snapshot)
Program.RestoreSnapshot(36); //MaxSnapShot - 1
@ -112,7 +112,10 @@ namespace PersistentWindows.SystrayShell
if (clickCount == 1 && firstClick && !doubleClick)
{
if (ctrlKeyPressed > 0)
Program.BringForegroundToBackground();
if (altKeyPressed > 0)
Program.FgWindowToBottom();
else
Program.BringForegroundToBackground();
else
//restore unnamed(default) snapshot
Program.RestoreSnapshot(0);