Fix/win32 ime setcontext lparam#4485
Open
Touma-Kazusa2 wants to merge 2 commits intorust-windowing:masterfrom
Open
Fix/win32 ime setcontext lparam#4485Touma-Kazusa2 wants to merge 2 commits intorust-windowing:masterfrom
Touma-Kazusa2 wants to merge 2 commits intorust-windowing:masterfrom
Conversation
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.
• ## Summary
Fix Win32 IME UI flag masking in the
WM_IME_SETCONTEXTpath.Problem
For
WM_IME_SETCONTEXT, IME UI visibility flags (includingISC_SHOWUICOMPOSITIONWINDOW) are carried inlParam.The current code masks
ISC_SHOWUICOMPOSITIONWINDOWonwParam, so the intended flag is not actually cleared.Reproduction / Observed behavior (Windows + Microsoft Pinyin)
extra UI disappears.
Behavioral linkage (cause -> effect)
WM_IME_SETCONTEXTis the context-(re)activation point (startup first input / first input after refocus).lParam(ISC_*flags).DefWindowProcW.wParam, so the intended suppression did not actually affect the UI-flag carrier(
lParam).WM_IME_ENDCOMPOSITION), so that extra box disappears withthe ended session.
WM_IME_SETCONTEXTis usually not re-entered, so the faulty path is not retriggered until thenext context reactivation.
Change
Mask
ISC_SHOWUICOMPOSITIONWINDOWonlParam(notwParam) before forwarding toDefWindowProcW.Why changing
lParamhere is expectedThis does not mutate the OS message source. Windows still provides the original
wParam/lParamforWM_IME_SETCONTEXT.Per Microsoft docs, apps that handle composition display should clear
ISC_SHOWUICOMPOSITIONWINDOWinlParambeforecalling
DefWindowProc.References
WM_IME_SETCONTEXT
https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-setcontext
WM_IME_ENDCOMPOSITION
https://learn.microsoft.com/en-us/windows/win32/intl/wm-ime-endcomposition
IMR_COMPOSITIONWINDOW
https://learn.microsoft.com/en-us/windows/win32/intl/imr-compositionwindow
Scope
Windows backend only (
winit-win32).Validation
cargo test -p winit-win32bevy 0.18example:examples/input/text_input.rs(Microsoft Pinyin).Related
Checklist
changelogfor this user-visible change