Remove Timer from WindowsKeyboardSwitchingAdapter and add IME diag#1495
Remove Timer from WindowsKeyboardSwitchingAdapter and add IME diag#1495jasonleenaylor wants to merge 1 commit intomasterfrom
Conversation
SIL.Windows.Forms.Keyboarding/Windows/WindowsKeyboardSwitchingAdapter.cs
Show resolved
Hide resolved
| RestoreImeConversionStatus(keyboard); | ||
| TraceImeState("PostSwitch", focusAfter, keyboard); |
There was a problem hiding this comment.
🚩 Removal of Timer-based IME retry may regress intermittent IME activation issues
The old code had a Timer (500ms interval) that would call RestoreImeConversionStatus a second time after keyboard switching, with the comment "Restore it even though sometimes windows will ignore us" and "Start the timer for restoring IME status for when windows ignores us." This was a deliberate workaround for an intermittent Windows behavior where the OS would silently reset IME conversion status shortly after it was set. The new code calls RestoreImeConversionStatus only once (line 67) and relies on the added diagnostic tracing to investigate the root cause instead. This is a reasonable approach for diagnosis, but the behavioral change means IME users (particularly Chinese/Japanese/Korean input) may see the intermittent mode-reset issue return until a more robust fix is implemented.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
The Timer and the restore it attempted was very clearly the source of an intermittent error with Chinese Pinyin IME keyboards that rendered them unusable for a subset of users. The reason for it was actually removed quite a while back and testing so far indicates that all switching is working better without the timer now.
SIL.Windows.Forms.Keyboarding/Windows/WindowsKeyboardSwitchingAdapter.cs
Show resolved
Hide resolved
Palaso Tests 4 files ±0 4 suites ±0 10m 44s ⏱️ +33s For more details on these failures, see this check. Results for commit ea7c9a2. ± Comparison against base commit ce83cef. ♻️ This comment has been updated with latest results. |
…tics Replace the Timer-based deferred IME conversion status restore with synchronous restore. The Timer caused jittery, unreliable IME switching for Chinese Pinyin and other TSF-based IMEs. The synchronous approach ensures ImmSetConversionStatus is applied before any subsequent SaveImeConversionStatus can capture stale values. Add Trace.WriteLine diagnostic logging throughout keyboard switching, IME save/restore, and post-switch state verification to aid debugging of intermittent IME composition issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c509789 to
ea7c9a2
Compare
Replace the Timer-based deferred IME conversion status restore with synchronous restore. The Timer caused jittery, unreliable IME switching for Chinese Pinyin and other TSF-based IMEs. The synchronous approach ensures ImmSetConversionStatus is applied before any subsequent SaveImeConversionStatus can capture stale values.
Add Trace.WriteLine diagnostic logging throughout keyboard switching, IME save/restore, and post-switch state verification to aid debugging of intermittent IME composition issues.
This change is