mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
new feature: ctrl click pw icon to restore foreground window to its last closing position
This commit is contained in:
parent
42533389f2
commit
5999a5bff6
3 changed files with 13 additions and 6 deletions
|
@ -855,7 +855,7 @@ namespace PersistentWindows.Common
|
|||
return offscreen;
|
||||
}
|
||||
|
||||
private bool RecallLastKilledPosition(IntPtr hwnd)
|
||||
public bool RecallLastKilledPosition(IntPtr hwnd)
|
||||
{
|
||||
if (deadApps.ContainsKey(curDisplayKey))
|
||||
{
|
||||
|
@ -882,8 +882,8 @@ namespace PersistentWindows.Common
|
|||
// found match
|
||||
RECT r = appPos.ScreenPosition;
|
||||
User32.MoveWindow(hwnd, r.Left, r.Top, r.Width, r.Height, true);
|
||||
Log.Error("Recover last close location\"{0}\"", GetWindowTitle(hwnd));
|
||||
deadApps[curDisplayKey].RemoveAt(idx);
|
||||
Log.Error("Recover last closing location\"{0}\"", GetWindowTitle(hwnd));
|
||||
//deadApps[curDisplayKey].RemoveAt(idx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1730,7 +1730,7 @@ namespace PersistentWindows.Common
|
|||
return fixZorder == 2 || (restoringSnapshot && fixZorder > 0);
|
||||
}
|
||||
|
||||
private IntPtr GetForegroundWindow()
|
||||
public IntPtr GetForegroundWindow()
|
||||
{
|
||||
IntPtr topMostWindow = User32.GetTopWindow(desktopWindow);
|
||||
for (IntPtr hwnd = topMostWindow; hwnd != IntPtr.Zero; hwnd = User32.GetWindow(hwnd, 2))
|
||||
|
|
|
@ -543,6 +543,11 @@ namespace PersistentWindows.SystrayShell
|
|||
pwp.FgWindowToBottom();
|
||||
}
|
||||
|
||||
static public void RecallLastKilledPosition()
|
||||
{
|
||||
pwp.RecallLastKilledPosition(pwp.GetForegroundWindow());
|
||||
}
|
||||
|
||||
static public void PauseAutoRestore()
|
||||
{
|
||||
pwp.pauseAutoRestore = true;
|
||||
|
|
|
@ -111,9 +111,11 @@ namespace PersistentWindows.SystrayShell
|
|||
{
|
||||
if (clickCount == 1 && firstClick && !doubleClick)
|
||||
{
|
||||
if (ctrlKeyPressed > 0 && altKeyPressed > 0)
|
||||
if (ctrlKeyPressed > 0 && altKeyPressed > 0 && shiftKeyPressed == 0)
|
||||
Program.FgWindowToBottom();
|
||||
else
|
||||
else if (ctrlKeyPressed > 0 && altKeyPressed == 0 && shiftKeyPressed == 0)
|
||||
Program.RecallLastKilledPosition();
|
||||
else if (ctrlKeyPressed == 0 && altKeyPressed == 0 && shiftKeyPressed == 0)
|
||||
//restore unnamed(default) snapshot
|
||||
Program.RestoreSnapshot(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue