hide webpage commander window during mouse move, reduce flicker when unhide

This commit is contained in:
Kang Yu 2024-07-27 16:14:30 -07:00
parent 2b36e580b9
commit b8a03dd189

View file

@ -825,6 +825,7 @@ namespace PersistentWindows.Common
else if (Math.Abs(cursorPos.X - lastCursorPos.X) > 3 || Math.Abs(cursorPos.Y - lastCursorPos.Y) > 3) else if (Math.Abs(cursorPos.X - lastCursorPos.X) > 3 || Math.Abs(cursorPos.Y - lastCursorPos.Y) > 3)
{ {
//mouse moving, continue monitor //mouse moving, continue monitor
Visible = false;
} }
else else
{ {
@ -862,9 +863,10 @@ namespace PersistentWindows.Common
} }
bool regain_focus = true; bool regain_focus = true;
bool change_to_visible = false;
if (!Visible) if (!Visible)
{ {
Visible = true; change_to_visible = true;
TopMost = true; TopMost = true;
if (defocused) if (defocused)
{ {
@ -886,12 +888,14 @@ namespace PersistentWindows.Common
// let tiny hotkey window follow cursor position // let tiny hotkey window follow cursor position
ResetHotKeyVirtualDesktop(); ResetHotKeyVirtualDesktop();
ResetHotkeyWindowPos();
if (change_to_visible)
Visible = true;
if (regain_focus) if (regain_focus)
{ {
User32.SetForegroundWindow(Handle); User32.SetForegroundWindow(Handle);
User32.SetFocus(Handle); User32.SetFocus(Handle);
} }
ResetHotkeyWindowPos();
if (hCursor == Cursors.Default.Handle) if (hCursor == Cursors.Default.Handle)
{ {