Avoid Windows modifier and TSF input hangs#715
Conversation
PR Reviewer Guide 🔍(Review updated until commit 20dcf2a)Here are some key observations to aid the review process:
|
|
Updated this PR with the follow-up root-cause finding and fix. The newer local dumps pointed beyond modifier-key swallowing: affected Chromium/Electron-style apps were loading the OpenLess TSF DLL through the Windows text-input stack, then hanging in COM/message-wait paths. The new commit disables OpenLess TSF registration/activation by default and keeps dictation working through paced Unicode SendInput. Legacy OpenLess TSF registration is still cleaned during install/upgrade/uninstall. This should address the recurring taskbar/app-window hang without disabling OpenLess or requiring users to avoid single Right Ctrl / Right Alt hotkeys. |
|
Persistent review updated to latest commit 538d799 |
|
Persistent review updated to latest commit 20dcf2a |
User description
Summary
This PR addresses a Windows hang pattern where taskbar interactions and already-open app windows appear frozen after OpenLess dictation is used with modifier-only hotkeys such as Right Ctrl or Right Alt.
The current root fix is to keep OpenLess dictation usable while disabling the in-process Windows TSF IME backend by default. OpenLess now inserts through paced Unicode
SendInputby default, and the TSF backend is treated as optional/experimental instead of being registered and activated for every Windows install.Root Cause
Local dump and event-log analysis showed affected Chromium/Electron processes loading the Windows text-input stack together with OpenLess's TSF DLL:
OpenLessIme.dllMSCTF.dllTextInputFramework.dllweasel.dll/ Rime Weasel text-input chainWaitForSingleObjectandSendMessageTimeoutWThe visible symptom can look like Explorer or the taskbar is broken, but the more repeatable failure is that foreground app UI threads hang while Windows text input is participating in the host process. Clicking a minimized Chrome/Codex/Notepad-style window from the taskbar then appears to do nothing because the target app is already stuck.
The earlier modifier-only hotkey fix is still useful because OpenLess should not swallow physical Ctrl/Alt events. However, later captures showed hangs still occurring after changing hotkeys, so the TSF backend itself is the higher-confidence root cause.
Changes
windows_tsf_backend_enabled, defaulting tofalsefor existing and new users.WindowsImeBackend::prepare_session()unless the experimental TSF backend is explicitly enabled.SendInputand fall back to clipboard copy if that fails.OpenLessIme.dllas a TSF TIP by default.Local Mitigation Verified
On the affected Windows machine, the installed legacy OpenLess registration pointed to:
C:\Program Files\OpenLess\windows-ime\x64\OpenLessIme.dllC:\Program Files\OpenLess\windows-ime\x86\OpenLessIme.dllHKLM\Software\Microsoft\CTF\TIP\{6B9F3F4F-5EE7-42D6-9C61-9F80B03A5D7D}After removing those OpenLess-specific TSF registration keys, registry re-checks confirmed they were absent. This does not disable OpenLess itself and does not change other Windows input methods.
Validation
Ran locally:
Results:
Compatibility Notes
This intentionally changes the default Windows insertion path from TSF to Unicode
SendInput. That is less invasive because it does not inject an OpenLess text-service DLL into Chromium/Electron/Notepad-style target processes. The packaged TSF DLLs and cleanup hooks remain available so a future explicit opt-in path can be added without leaving legacy registrations behind.PR Type
Bug fix, Enhancement
Description
Disable Windows TSF IME backend by default
Avoid swallowing modifier-only hotkeys
Update installers to skip TSF registration
Add runtime checks to block TSF in shell processes
Diagram Walkthrough
flowchart LR A["Dictation session start"] --> B{"Windows TSF backend enabled?"} B -->|Yes| C["Prepare TSF IME session (experimental)"] B -->|No| D["Insert via paced Unicode SendInput"] C --> E["Insert via TSF"] D --> F["If SendInput fails, copy to clipboard"]File Walkthrough
4 files
Adjust log messages in TSF fallbackConditionally prepare TSF IME sessionAdd windows_tsf_backend_enabled preferenceAdd windowsTsfBackendEnabled field3 files
Do not suppress modifier-only hotkeysBlock injection into shell processesDeactivate TSF in explorer process6 files
Update status messages for experimental TSFUpdate descriptions for TSF and fallbackUpdate Japanese translations for TSF changesUpdate Korean translations for TSF changesUpdate Chinese translations for TSF changesUpdate Chinese (Taiwan) translations for TSF changes4 files
Add windowsTsfBackendEnabled to mock dataAdd windowsTsfBackendEnabled to test dataAssert TSF registry keys are absentUpdate test assertions for skipped registration2 files
Skip default TSF registration in NSISRemove register actions from WiX InstallExecuteSequence