File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515` VirtualDesktopSwitcher::ActivateTopWindowOnMonitor(HMONITOR hMon) `
1616
17- - ** 跨屏** :` MouseFocus ` 钩子检测到显示器切换 → ` SendInput(MOUSEEVENTF_MOVE) ` + ` ActivateTopWindowOnMonitor(hMon) `
18- - ** 切桌面** :` OnDesktopSwitch ` → ` SwitchToDesktop ` → ` ActivateTopWindowOnMonitor(nullptr) ` (内部自动获取光标位置)
19-
20- ` AllowSetForegroundWindow(ASFW_ANY) ` 内置在 ` ActivateWindow ` 中(` src/util/Utils.cpp ` ),调用方无需关心前台锁。
21-
17+ - ` ActivateTopWindowOnMonitor ` 内部无条件调用 ` SendInput(MOUSEEVENTF_MOVE) ` 重置输入来源,绕过 Alt 后前台锁限制
18+ - ** 跨屏** :` MouseFocus ` 钩子检测显示器切换 → ` ActivateTopWindowOnMonitor(hMon) `
19+ - ** 切桌面** :` OnDesktopSwitch ` → ` SwitchToDesktop ` → ` ActivateTopWindowOnMonitor(nullptr) ` (自动获取光标位置)
20+ - ` AllowSetForegroundWindow(ASFW_ANY) ` 内置在 ` ActivateWindow ` 中(` src/util/Utils.cpp ` ),调用方无需关心前台锁
2221
2322| 问题 | 方案 |
2423| ---| ---|
Original file line number Diff line number Diff line change @@ -390,9 +390,6 @@ bool Application::Initialize() {
390390 }
391391
392392 m_mouseFocus->SetActivateFn ([this ](HMONITOR hMon) {
393- INPUT input{.type = INPUT_MOUSE ,
394- .mi = {.dwFlags = MOUSEEVENTF_MOVE }};
395- SendInput (1 , &input, sizeof (input));
396393 VirtualDesktopSwitcher::ActivateTopWindowOnMonitor (hMon);
397394 });
398395 m_mouseFocus->SetEnabled (m_indicatorCfg.autoFocus );
Original file line number Diff line number Diff line change @@ -191,6 +191,11 @@ bool VirtualDesktopSwitcher::ActivateTopWindowOnMonitor(HMONITOR hMon) {
191191 return false ;
192192 }
193193 }
194+
195+ INPUT input{.type = INPUT_MOUSE ,
196+ .mi = {.dwFlags = MOUSEEVENTF_MOVE }};
197+ SendInput (1 , &input, sizeof (input));
198+
194199 HWND hwnd = FindTopWindowOnMonitor (hMon);
195200 if (hwnd == nullptr || hwnd == GetShellWindow ()) {
196201 Log (L" [DEBUG] ActivateTopWindowOnMonitor: no window" );
You can’t perform that action at this time.
0 commit comments