[Bug 60449] New: Keys not used by the X input method are delivered twice, as VK_PROCESSKEY and as the real key, even with the IME closed
http://bugs.winehq.org/show_bug.cgi?id=60449 Bug ID: 60449 Summary: Keys not used by the X input method are delivered twice, as VK_PROCESSKEY and as the real key, even with the IME closed Product: Wine Version: 11.19 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: imm32 Assignee: wine-bugs@list.winehq.org Reporter: kagetaro1986@gmail.com Target Milestone: --- Distribution: --- Created attachment 82265 --> http://bugs.winehq.org/attachment.cgi?id=82265 imetest test program and logs (Windows 11, Wine unpatched/patched) with terminal output DESCRIPTION With a Japanese keyboard layout and an X input method, keys that the input method does not use (for example BackSpace with nothing composed, or any key while the input method is off) reach the application twice: a WM_KEYDOWN with VK_PROCESSKEY (ImmGetVirtualKey returns the real key), followed by the WM_KEYDOWN of the real key. Applications that handle VK_PROCESSKEY through ImmGetVirtualKey process the key twice. On Windows 11 such keys arrive only as the real key; only the keys processed by the IME are replaced with VK_PROCESSKEY. Analysis: ImeProcessKey returns TRUE for every key except Shift/Ctrl/Caps/Alt (/* TODO: should be ctx->fOpen */). With XIM, the keys that the input method handles are consumed by it before they reach Wine, and its changes arrive asynchronously (WINE_IME_POST_UPDATE), so every key that reaches ImeProcessKey is one the input method did not use. STEPS TO REPRODUCE 1. LC_ALL=ja_JP.UTF-8 XMODIFIERS=@im=fcitx wine imetest32.exe -a -o test.log 2. Without switching the input method on, type a, BackSpace. 3. Switch it on, commit something, then press BackSpace with nothing composed. Actual: each key down appears twice in the log (VK_PROCESSKEY, then the real key). Expected (Windows 11 logs attached): only the real key. PATCH Fixed by 0002-imm32-Post-the-IME-messages-and-keep-the-result-stri.patch attached to bug 60448, which makes ImeProcessKey return FALSE. Possibly related: bug 59737. ENVIRONMENT - Ubuntu 24.04.5 LTS, x86_64. Interactive tests on KDE Plasma (X11); the logged runs use Xvfb + openbox. - fcitx5 5.1.7 with fcitx5-mozc 2.28.4715.102 (Japanese), XIM frontend, on-the-spot preedit (UseOnTheSpot=True), LC_ALL=ja_JP.UTF-8, XMODIFIERS=@im=fcitx. - Wine 11.19 built from the WineHQ source (configure --enable-archs=i386,x86_64, i.e. the new WoW64 mode), fresh prefix, no DLL overrides when running the test (Mono/Gecko installation skipped while the prefix was created). Same results with Wine 11.19 + Staging. The files involved (dlls/imm32, dlls/win32u/imm.c, dlls/winex11.drv/xim.c) are unchanged in master as of 2026-10-05. - Comparison: Windows 11 Pro 26H2 (build 26300), Microsoft IME (current version, and the previous version where noted), Japanese 106/109 keyboard. TEST PROGRAM imetest.c (attached, standalone, no dependencies) creates one window with default IME handling and a PeekMessage loop, and logs for every IME and keyboard message whether it was taken from the queue (LOOP) or sent to the window procedure (PROC/sent), and what ImmGetCompositionString, ImmGetOpenStatus and ImmGetConversionStatus return at that moment. IDLE lines record the state once the queue is empty. Build: i686-w64-mingw32-gcc -O1 -o imetest32.exe imetest.c -limm32 -lshell32 -mwindows (64-bit: x86_64-w64-mingw32-gcc). Options: -a ANSI window (default Unicode), -recreate, -open, -auto (types the scenario with SendInput; Windows only), -o <log>. On Wine the scenario was typed through XTEST with drive_x11.py (attached), so that the keys go through the X input method like real key presses. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60449 --- Comment #1 from Kagetaro078 <kagetaro1986@gmail.com> --- Still the same with Wine 11.19 and current master (dlls/imm32, dlls/win32u/imm.c and dlls/winex11.drv/xim.c are unchanged). I have since moved to Ubuntu 26.04.1 (KDE Plasma 6, Wayland session, Wine on XWayland, fcitx5 XIM frontend); the behaviour is identical there and the patch attached to bug 60448 still applies and fixes it. The attached logs were made in Xvfb and are not affected by the desktop change. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla