Repository navigation
Keep a lone Alt or F10 from freezing the Desktop window on Windows - #1648
Merged
Merged
Conversation
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 14, 2026 21:27
davidmckayv
force-pushed
the
desktop/windows-ipc-lost-wake
branch
3 times, most recently
from
November 15, 2026 16:16
9147f55 to
18ade1d
Compare
A lone Alt or F10 makes DefWindowProc send the top-level window WM_SYSCOMMAND/SC_KEYMENU with lParam 0, which starts a modal menu loop on the window's thread even though the window has no menu bar. While the thread is in it, WebView2's page and OpenBot stop hearing each other: an invoke's answer does not reach the page and the page's next invoke does not reach OpenBot, until a click, Esc or Alt+Tab. On a Windows box a lone Alt during `local update` held the update's answer back from the page for 530 s, until a right-click on the tray icon. The main and Status windows now answer that one command themselves. Alt+Space, Alt with a letter and a click on the window icon still reach DefWindowProc, and the page still gets Alt's keydown and keyup. OpenBot also stops pressing Alt itself: tao's set_focus presses and releases Alt when SetForegroundWindow is refused. Every window now comes forward through one helper that uses SetForegroundWindow and flashes the taskbar when Windows refuses, as bring_to_front already did.
davidmckayv
force-pushed
the
desktop/windows-ipc-lost-wake
branch
from
November 15, 2026 17:10
18ade1d to
a9af1d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows, a lone Alt or F10 in the OpenBot window could freeze the link between the window's page and OpenBot until the person clicked somewhere. Setup, start and update looked stuck: the elapsed timer kept ticking but nothing else moved.
Why it happened
A lone Alt or F10 makes
DefWindowProcsend the top-level windowWM_SYSCOMMANDwithSC_KEYMENUand anlParamof 0. Handled as it is (tao 0.37.2 passes it straight toDefWindowProc), that starts a modal menu loop on the window's thread, even though OpenBot's windows have no menu bar, so nothing on screen shows it. While the thread is in that loop, WebView2's page and OpenBot stop hearing each other in both directions. An invoke's answer does not reach the page, and the page's next invoke does not reach OpenBot, until a click, Esc or Alt+Tab ends the loop.On a Windows Server 2022 box, the round-trip logging from #1602 caught it:
local update.local update's answer was handed back at 20:56:41 and reached the page 530.2 s later, within a second of a right-click on the tray icon.Other Tauri apps on WebView2 have measured the same freeze and fixed it the same way.
OpenBot could also cause it itself. tao's
set_focuspresses and releases Alt whenSetForegroundWindowis refused (force_window_active), and eight places still called it on Windows.The change
key_menu.rs: the main and Status windows get a subclass that answersSC_KEYMENUwith a zerolParamitself. Everything else still reachesDefWindowProc: Alt+Space (the window menu), Alt with a letter, and a click on the window icon (SC_MOUSEMENU). The page still gets Alt's and F10's keydown and keyup, which arrive before this command and are not touched, so its Alt shortcuts work as before.focusinmain.rs: every window now comes forward the waybring_to_frontalready did on Windows. It usesSetForegroundWindow, and if Windows refuses, the taskbar button flashes. No key is ever pressed on the person's behalf. That covers the shutting-down screen, Status, this computer's settings, setup, the tray's Open, and the three host-access prompts indesktop_host_access.rs.Tests
key_menu::tests::only_a_menu_key_pressed_alone_is_dropped: the rule for whichWM_SYSCOMMANDs are dropped.key_menu::tests::a_lone_alt_puts_no_subclassed_window_in_menu_mode(Windows): it posts a realSC_KEYMENUwithlParam0 to two windows on their own message-loop thread.GetGUIThreadInforeportsGUI_INMENUMODE). That proves the desktop reproduces the freeze, and it is what OpenBot's window did without the subclass.coming_forward_with_another_window_in_front_flashes_and_sends_no_inputnow checks that noset_focuscall is left outsidefocus's non-Windows branch, inmain.rsanddesktop_host_access.rs.Proof on a Windows box
Windows Server 2022 with WebView2. A lone Alt and then F10 were pressed on the OpenBot window during a long-running step, and
GetGUIThreadInfowas read for OpenBot's UI thread.