#312, Ctrl + Shift + RestoreFromDisk to auto skip missing window

This commit is contained in:
Kang Yu 2024-04-21 23:10:03 -07:00
parent 7d77f64d79
commit 3b51f41f08
2 changed files with 15 additions and 8 deletions

View file

@ -94,7 +94,7 @@ namespace PersistentWindows.Common
private Timer restoreFinishedTimer;
public bool restoringFromMem = false; // automatic restore from memory or snapshot
public bool restoringFromDB = false; // manual restore from DB
private bool autoInitialRestoreFromDB = false;
public bool autoInitialRestoreFromDB = false;
public bool restoringSnapshot = false; // implies restoringFromMem
public bool showDesktop = false; // show desktop when display changes
public int fixZorder = 1; // 1 means restore z-order only for snapshot; 2 means restore z-order for all; 0 means no z-order restore at all

View file

@ -595,7 +595,9 @@ namespace PersistentWindows.SystrayShell
static public void RestoreFromDisk(bool ask_dialog)
{
if (ask_dialog || (User32.GetKeyState(0x10) & 0x8000) != 0) //shift key pressed
bool ctrl_key_pressed = (User32.GetKeyState(0x11) & 0x8000) != 0;
bool shift_key_pressed = (User32.GetKeyState(0x10) & 0x8000) != 0;
if (ask_dialog || (shift_key_pressed && !ctrl_key_pressed))
{
var listCollection = pwp.GetDbCollections();
var dlg = new DbKeySelect();
@ -615,7 +617,11 @@ namespace PersistentWindows.SystrayShell
else
{
pwp.dbDisplayKey = pwp.GetDisplayKey();
if ((User32.GetKeyState(0x11) & 0x8000) != 0) //ctrl key pressed
if (ctrl_key_pressed)
{
if (shift_key_pressed)
pwp.autoInitialRestoreFromDB = true;
else
{
var name = EnterDbEntryName();
if (String.IsNullOrEmpty(name))
@ -624,9 +630,10 @@ namespace PersistentWindows.SystrayShell
pwp.dbDisplayKey += name;
}
}
}
pwp.restoringFromDB = true;
pwp.StartRestoreTimer(milliSecond : 2000 /*wait mouse settle still for taskbar restore*/);
pwp.StartRestoreTimer(milliSecond : 1000 /*wait mouse settle still for taskbar restore*/);
}
static public void RestoreSnapshot(int id)