This fixes the behavior in notepad, with Japanese ibus-mozc IME, when typing "NIHONGO-SPACE-NO", or with Korean ibus-hangul when typing "GA-NA-DA". The latter still has an issue with the last character not appearing in the a composition but I believe it is unrelated to comctl32 and will be fixed by some future imm32 changes.
From: Rémi Bernon rbernon@codeweavers.com
When EIMES_GETCOMPSTRATONCE is set we delegate WM_IME_COMPOSITION to the default window proc, which sends the corresponding WM_IME_CHAR messages.
The WM_IME_CHAR messages were also delegated to the default window proc, and were translated to WM_CHAR messages, but these are posted and not sent, and are then processed asynchronously wrt the following WM_IME_* messages, and end up being handled out-of-order.
This fixes the message ordering issue by processing WM_IME_CHAR messages directly.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53860 --- dlls/comctl32/edit.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 883dd5d9145..2ad18cb401e 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -4854,6 +4854,7 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_CHAR: + case WM_IME_CHAR: { WCHAR charW = wParam;
From: Rémi Bernon rbernon@codeweavers.com
After WM_IME_CHAR messages have been processed the selected text offsets are updated and we need to reflect these in the composition offsets so that further WM_IME_* messages insert new composition strings after the new text and not before.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53860 --- dlls/comctl32/edit.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 2ad18cb401e..edcf2d0707b 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -5060,6 +5060,8 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (lParam & GCS_RESULTSTR && !(es->ime_status & EIMES_GETCOMPSTRATONCE)) { DefWindowProcW(hwnd, msg, wParam, lParam); + es->composition_start = es->selection_start; + es->composition_len = es->selection_end - es->selection_start; break; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=132395
Your paranoid android.
=== debian11 (32 bit report) ===
comctl32: edit.c:3740: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000 edit.c:3761: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000
=== debian11 (32 bit zh:CN report) ===
comctl32: edit.c:3740: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000 edit.c:3761: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000
=== debian11b (64 bit WoW report) ===
comctl32: edit.c:3740: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000 edit.c:3761: Test failed: WM_IME_CHAR: the msg sequence is not complete: expected 0102 - actual 0000
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/edit.c:
break;
When EIMES_GETCOMPSTRATONCE is set we delegate WM_IME_COMPOSITION to the default window proc
Shouldn't it be "not set"?
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/edit.c:
break;
Also, we usually use something like "comctl32/edit: ..." in the commit subject.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/edit.c:
break; case WM_CHAR:
- case WM_IME_CHAR:
Are you going to do the same for user32/edit? You can put it in the same series.
On Thu May 4 09:47:51 2023 +0000, Zhiyi Zhang wrote:
When EIMES_GETCOMPSTRATONCE is set we delegate WM_IME_COMPOSITION to
the default window proc Shouldn't it be "not set"?
Indeed.
On Thu May 4 09:51:49 2023 +0000, Zhiyi Zhang wrote:
Are you going to do the same for user32/edit? You can put it in the same series.
Yeah, though it looks like it doesn't pass the tests...
Here's my updated personal patchset, hopefully it will help with your implementation.
[poc_fix_edit_control_ime_code.patch](/uploads/e3d25a4d734328dda09c5df0b99bb709/poc_fix_edit_control_ime_code.patch)
From additional tests it looks that like the composition string is simply not updating the edit control selection or text until it is committed. A better fix would probably be to keep it separate, and display it separately too.
On Thu May 4 13:17:50 2023 +0000, Rémi Bernon wrote:
From additional tests it looks that like the composition string is simply not updating the edit control selection or text until it is committed. A better fix would probably be to keep it separate, and display it separately too.
Yes. That's good too.
Since the current edit control is implemented differently than the native behaviour, I was looking for a simple way to do it.
From additional tests it looks that like the composition string is simply not updating the edit control selection or text until it is committed.
This is probably because you're testing Japanese or Chinese IMEs. In this case, the composition string is handled in the ime_ui_window_proc.
Because the MS native ime_ui_window_proc is currently implemented more complexly than Wine's, it looks as if the edit control is drawing. However, upon further investigation, this is not the case.