From c535968128f929e73182c72f52ac1d44879e1aea Mon Sep 17 00:00:00 2001 From: Kotomine Shiki <126475460+Touma-Kazusa2@users.noreply.github.com> Date: Sun, 1 Mar 2026 21:08:45 +0800 Subject: [PATCH] win32: fix ime setcontext lparam Fixes #3893. --- winit-win32/src/event_loop.rs | 6 +++--- winit/src/changelog/unreleased.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/winit-win32/src/event_loop.rs b/winit-win32/src/event_loop.rs index 925f01f56..8f1008f98 100644 --- a/winit-win32/src/event_loop.rs +++ b/winit-win32/src/event_loop.rs @@ -1503,9 +1503,9 @@ unsafe fn public_window_callback_inner( }, WM_IME_SETCONTEXT => { - // Hide composing text drawn by IME. - let wparam = wparam & (!ISC_SHOWUICOMPOSITIONWINDOW as usize); - result = ProcResult::DefWindowProc(wparam); + // IME UI visibility flags are in lparam. + let lparam = lparam & !(ISC_SHOWUICOMPOSITIONWINDOW as isize); + result = ProcResult::Value(unsafe { DefWindowProcW(window, msg, wparam, lparam) }); }, // this is necessary for us to maintain minimize/restore state diff --git a/winit/src/changelog/unreleased.md b/winit/src/changelog/unreleased.md index ceab7e091..1a4158644 100644 --- a/winit/src/changelog/unreleased.md +++ b/winit/src/changelog/unreleased.md @@ -55,5 +55,6 @@ changelog entry. - On Redox, handle `EINTR` when reading from `event_socket` instead of panicking. - On Wayland, switch from using the `ahash` hashing algorithm to `foldhash`. - On macOS, fix borderless game presentation options not sticking after switching spaces. +- On Windows, fix `WM_IME_SETCONTEXT` IME UI flag masking on `lParam`. - On macOS, fix crash in `set_marked_text` when native Pinyin IME sends out-of-bounds `selected_range`. - On X11, fix debug mode overflow panic in `set_timestamp`.