mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 04:55:39 +02:00
avoid webpage activation disturb auto restore
This commit is contained in:
parent
e7b52a035c
commit
bed63a11f4
2 changed files with 10 additions and 3 deletions
|
@ -30,6 +30,7 @@ namespace PersistentWindows.Common
|
|||
private bool active = false;
|
||||
private static bool tiny = false;
|
||||
private static bool browserWindowActivated = false;
|
||||
private static bool restoring = false;
|
||||
private int origWidth;
|
||||
private int origHeight;
|
||||
private int mouseOffset = 0; //mouse dithering to workaround mouse location mis-update issue in rdp session
|
||||
|
@ -635,9 +636,10 @@ namespace PersistentWindows.Common
|
|||
}
|
||||
|
||||
|
||||
public static void BrowserActivate(IntPtr hwnd, bool is_browser_window = true)
|
||||
public static void BrowserActivate(IntPtr hwnd, bool is_browser_window = true, bool in_restore = false)
|
||||
{
|
||||
browserWindowActivated = is_browser_window;
|
||||
restoring = in_restore;
|
||||
|
||||
if (!tiny && !User32.IsWindowVisible(commanderWnd))
|
||||
return;
|
||||
|
@ -822,12 +824,17 @@ namespace PersistentWindows.Common
|
|||
IntPtr fgwnd = GetForegroundWindow();
|
||||
if (!PersistentWindowProcessor.IsBrowserWindow(fgwnd))
|
||||
{
|
||||
if (browserWindowActivated)
|
||||
if (browserWindowActivated || restoring)
|
||||
StartAliveTimer(6, 1000);
|
||||
else
|
||||
Visible = false;
|
||||
return;
|
||||
}
|
||||
else if (restoring)
|
||||
{
|
||||
StartAliveTimer(6, 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
RECT rect = new RECT();
|
||||
User32.GetWindowRect(fgwnd, ref rect);
|
||||
|
|
|
@ -1321,7 +1321,7 @@ namespace PersistentWindows.Common
|
|||
{
|
||||
IntPtr topHwnd = User32.GetAncestor(hwnd, User32.GetAncestorRoot);
|
||||
if (hwnd == topHwnd)
|
||||
HotKeyWindow.BrowserActivate(topHwnd);
|
||||
HotKeyWindow.BrowserActivate(topHwnd, in_restore : restoringFromMem);
|
||||
}
|
||||
else
|
||||
HotKeyWindow.BrowserActivate(hwnd, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue