Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
-- v2: comctl32/edit: Handle IME composition result string only when EIMES_GETCOMPSTRATONCE is set. comctl32/edit: Let DefWindowProcW() handle WM_IME_CHAR. comctl32/edit: Implement EM_GETIMESTATUS. comctl32/edit: Implement EM_SETIMESTATUS. comctl32/tests: Add IME tests for edit control.
From: Zhiyi Zhang zzhang@codeweavers.com
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/tests/Makefile.in | 2 +- dlls/comctl32/tests/edit.c | 211 ++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in index 4669efcf2b5..3f80250081c 100644 --- a/dlls/comctl32/tests/Makefile.in +++ b/dlls/comctl32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = comctl32.dll -IMPORTS = ole32 user32 gdi32 advapi32 +IMPORTS = ole32 user32 gdi32 advapi32 imm32
C_SRCS = \ animate.c \ diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 4bfbecc713b..e13976a2387 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -20,6 +20,7 @@
#include <windows.h> #include <commctrl.h> +#include <imm.h>
#include "wine/test.h" #include "v6util.h" @@ -3441,6 +3442,215 @@ static void test_change_focus(void) DestroyWindow(hwnd); }
+static const struct message wm_ime_composition_seq[] = +{ + {WM_IME_STARTCOMPOSITION, sent}, + {WM_IME_COMPOSITION, sent | wparam, 'W'}, + {WM_IME_CHAR, sent | wparam | defwinproc, 'W'}, + {WM_IME_CHAR, sent | wparam | defwinproc, 'i'}, + {WM_IME_CHAR, sent | wparam | defwinproc, 'n'}, + {WM_IME_CHAR, sent | wparam | defwinproc, 'e'}, + {WM_IME_ENDCOMPOSITION, sent}, + {WM_CHAR, sent | wparam, 'W'}, + {WM_CHAR, sent | wparam, 'i'}, + {WM_CHAR, sent | wparam, 'n'}, + {WM_CHAR, sent | wparam, 'e'}, + {0} +}; + +static const struct message wm_ime_char_seq[] = +{ + {WM_IME_CHAR, sent | wparam, '0'}, + {WM_CHAR, sent | wparam, '0'}, + {0} +}; + +static const struct message eimes_getcompstratonce_seq[] = +{ + {WM_IME_STARTCOMPOSITION, sent}, + {WM_IME_COMPOSITION, sent | wparam, 'W'}, + {WM_IME_ENDCOMPOSITION, sent}, + {0} +}; + +static LRESULT CALLBACK edit_ime_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + static LONG defwndproc_counter = 0; + struct message msg = {0}; + LRESULT ret; + + msg.message = message; + msg.flags = sent | wparam; + if (defwndproc_counter) + msg.flags |= defwinproc; + msg.wParam = wParam; + + if (message < 0xc000 && + message != WM_GETTEXTLENGTH && + message != WM_GETTEXT && + message != WM_GETFONT && + message != WM_GETICON && + message != WM_IME_SETCONTEXT && + message != WM_IME_NOTIFY && + message != WM_CTLCOLOREDIT && + message != WM_PAINT && + message != WM_ERASEBKGND && + message != WM_NCHITTEST && + message != WM_SETCURSOR && + message != WM_MOUSEMOVE && + message != WM_MOUSEACTIVATE && + message != WM_KEYUP && + (message < EM_GETSEL || message > EM_GETIMESTATUS)) + { + add_message(sequences, COMBINED_SEQ_INDEX, &msg); + } + + defwndproc_counter++; + if (IsWindowUnicode(hwnd)) + ret = CallWindowProcW(oldproc, hwnd, message, wParam, lParam); + else + ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam); + defwndproc_counter--; + + return ret; +} + +static void test_ime(void) +{ + WNDPROC old_proc; + LRESULT lr; + HIMC himc; + HWND hwnd; + BOOL ret; + MSG msg; + + hwnd = create_editcontrol(WS_POPUP | WS_VISIBLE, 0); + + /* Test EM_{GET|SET}IMESTATUS */ + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); + + /* Note that EM_SETIMESTATUS always return 1, which is contrary to what MSDN says about + * returning the previous LPARAM value */ + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_CANCELCOMPSTRINFOCUS); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == EIMES_CANCELCOMPSTRINFOCUS, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_COMPLETECOMPSTRKILLFOCUS); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == EIMES_COMPLETECOMPSTRKILLFOCUS, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE + | EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == (EIMES_GETCOMPSTRATONCE | EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS), + "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); + + /* Invalid EM_{GET|SET}IMESTATUS status types and flags */ + lr = SendMessageA(hwnd, EM_GETIMESTATUS, 0, 0); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING + 1, 0); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, 0, EIMES_GETCOMPSTRATONCE); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING + 1, EIMES_GETCOMPSTRATONCE); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0xFFFFFFFF); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == 0xFFFF, "Got unexpected lr %#Ix.\n", lr); + + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); + + /* Test IME messages when EIMES_GETCOMPSTRATONCE is not set */ + old_proc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)edit_ime_subclass_proc); + SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)old_proc); + + himc = ImmGetContext(hwnd); + ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + ok(ret, "ImmSetCompositionStringA failed.\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + ok(ret, "ImmNotifyIME failed.\n"); + /* Note that the following message loop is necessary to get the WM_CHAR messages because they + * are posted. Same for the later message loops in this function. */ + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_composition_seq, "WM_IME_COMPOSITION", TRUE); + + /* Test that WM_IME_CHAR is passed to DefWindowProc() to get WM_CHAR */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(hwnd, WM_IME_CHAR, '0', 1); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", TRUE); + + /* Test IME messages when EIMES_GETCOMPSTRATONCE is set */ + lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); + todo_wine + ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); + lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); + todo_wine + ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr); + + ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + ok(ret, "ImmSetCompositionStringA failed.\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + ok(ret, "ImmNotifyIME failed.\n"); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, eimes_getcompstratonce_seq, + "WM_IME_COMPOSITION with EIMES_GETCOMPSTRATONCE", TRUE); + + /* Test that WM_IME_CHAR is passed to DefWindowProc() to get WM_CHAR with EIMES_GETCOMPSTRATONCE */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(hwnd, WM_IME_CHAR, '0', 1); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", TRUE); + + ImmReleaseContext(hwnd, himc); + DestroyWindow(hwnd); +} + START_TEST(edit) { ULONG_PTR ctx_cookie; @@ -3487,6 +3697,7 @@ START_TEST(edit) test_wordbreak_proc(); test_change_focus(); test_cue_banner(); + test_ime();
UnregisterWindowClasses();
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=121352
Your paranoid android.
=== w864 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
From: Zhiyi Zhang zzhang@codeweavers.com
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/edit.c | 10 +++++++++- dlls/comctl32/tests/edit.c | 10 ---------- 2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index f89e11c9203..01212df3525 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -25,7 +25,7 @@ * - EDITBALLOONTIP structure * - EM_HIDEBALLOONTIP/Edit_HideBalloonTip * - EM_SHOWBALLOONTIP/Edit_ShowBalloonTip - * - EM_GETIMESTATUS, EM_SETIMESTATUS + * - EM_GETIMESTATUS * - EN_ALIGN_LTR_EC * - EN_ALIGN_RTL_EC * - ES_OEMCONVERT @@ -143,6 +143,7 @@ typedef struct */ UINT composition_len; /* length of composition, 0 == no composition */ int composition_start; /* the character position for the composition */ + UINT ime_status; /* IME status flag */ /* * Uniscribe Data */ @@ -4810,6 +4811,13 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR result = EDIT_EM_GetCueBanner(es, (WCHAR *)wParam, (DWORD)lParam); break;
+ case EM_SETIMESTATUS: + if (wParam == EMSIS_COMPOSITIONSTRING) + es->ime_status = lParam & 0xFFFF; + + result = 1; + break; + /* End of the EM_ messages which were in numerical order; what order * are these in? vaguely alphabetical? */ diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index e13976a2387..de17fb26f93 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3534,21 +3534,18 @@ static void test_ime(void) /* Note that EM_SETIMESTATUS always return 1, which is contrary to what MSDN says about * returning the previous LPARAM value */ lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_CANCELCOMPSTRINFOCUS); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine ok(lr == EIMES_CANCELCOMPSTRINFOCUS, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_COMPLETECOMPSTRKILLFOCUS); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine @@ -3556,7 +3553,6 @@ static void test_ime(void)
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE | EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine @@ -3564,7 +3560,6 @@ static void test_ime(void) "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); @@ -3579,26 +3574,22 @@ static void test_ime(void) ok(lr == 1, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, 0, EIMES_GETCOMPSTRATONCE); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); ok(lr == 0, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING + 1, EIMES_GETCOMPSTRATONCE); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); ok(lr == 0, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0xFFFFFFFF); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine ok(lr == 0xFFFF, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); ok(lr == 0, "Got unexpected lr %#Ix.\n", lr); @@ -3626,7 +3617,6 @@ static void test_ime(void)
/* Test IME messages when EIMES_GETCOMPSTRATONCE is set */ lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); todo_wine
From: Zhiyi Zhang zzhang@codeweavers.com
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/edit.c | 5 ++++- dlls/comctl32/tests/edit.c | 8 -------- 2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 01212df3525..fbec6972fee 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -25,7 +25,6 @@ * - EDITBALLOONTIP structure * - EM_HIDEBALLOONTIP/Edit_HideBalloonTip * - EM_SHOWBALLOONTIP/Edit_ShowBalloonTip - * - EM_GETIMESTATUS * - EN_ALIGN_LTR_EC * - EN_ALIGN_RTL_EC * - ES_OEMCONVERT @@ -4818,6 +4817,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR result = 1; break;
+ case EM_GETIMESTATUS: + result = wParam == EMSIS_COMPOSITIONSTRING ? es->ime_status : 1; + break; + /* End of the EM_ messages which were in numerical order; what order * are these in? vaguely alphabetical? */ diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index de17fb26f93..94d17ba8730 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3536,26 +3536,22 @@ static void test_ime(void) lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_CANCELCOMPSTRINFOCUS); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == EIMES_CANCELCOMPSTRINFOCUS, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_COMPLETECOMPSTRKILLFOCUS); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == EIMES_COMPLETECOMPSTRKILLFOCUS, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE | EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == (EIMES_GETCOMPSTRATONCE | EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS), "Got unexpected lr %#Ix.\n", lr);
@@ -3566,11 +3562,9 @@ static void test_ime(void)
/* Invalid EM_{GET|SET}IMESTATUS status types and flags */ lr = SendMessageA(hwnd, EM_GETIMESTATUS, 0, 0); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING + 1, 0); - todo_wine ok(lr == 1, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, 0, EIMES_GETCOMPSTRATONCE); @@ -3586,7 +3580,6 @@ static void test_ime(void) lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0xFFFFFFFF); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == 0xFFFF, "Got unexpected lr %#Ix.\n", lr);
lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); @@ -3619,7 +3612,6 @@ static void test_ime(void) lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); ok(lr == 1, "Got unexpected lr %#Ix.\n", lr); lr = SendMessageA(hwnd, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0); - todo_wine ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0);
From: Zhiyi Zhang zzhang@codeweavers.com
So that WM_IME_CHAR will be converted to WM_CHAR in DefWindowProcW().
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/edit.c | 1 - dlls/comctl32/tests/edit.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index fbec6972fee..2fb97b174b3 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -4859,7 +4859,6 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR } break;
- case WM_IME_CHAR: case WM_CHAR: { WCHAR charW = wParam; diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 94d17ba8730..e588df8170b 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3606,7 +3606,7 @@ static void test_ime(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, WM_IME_CHAR, '0', 1); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); - ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", TRUE); + ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", FALSE);
/* Test IME messages when EIMES_GETCOMPSTRATONCE is set */ lr = SendMessageA(hwnd, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING, EIMES_GETCOMPSTRATONCE); @@ -3627,7 +3627,7 @@ static void test_ime(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(hwnd, WM_IME_CHAR, '0', 1); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); - ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", TRUE); + ok_sequence(sequences, COMBINED_SEQ_INDEX, wm_ime_char_seq, "WM_IME_CHAR", FALSE);
ImmReleaseContext(hwnd, himc); DestroyWindow(hwnd);
From: Zhiyi Zhang zzhang@codeweavers.com
If EIMES_GETCOMPSTRATONCE is not set, WM_IME_COMPOSITION with LPARAM set to GCS_RESULTSTR should be passed to the default window procedure according to MSDN.
Fix some windows based on edit control not being able to input Chinese.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/edit.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c index 2fb97b174b3..5b900825981 100644 --- a/dlls/comctl32/edit.c +++ b/dlls/comctl32/edit.c @@ -5062,6 +5062,12 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_IME_COMPOSITION: + if (lParam & GCS_RESULTSTR && !(es->ime_status & EIMES_GETCOMPSTRATONCE)) + { + DefWindowProcW(hwnd, msg, wParam, lParam); + break; + } + EDIT_ImeComposition(hwnd, lParam, es); break;
On Tue Aug 16 12:11:05 2022 +0000, Nikolay Sivov wrote:
I get a bunch of warnings for printf format for LRESULT values, on 64-bit. I'm not familiar with how IME works, so I can only run these tests locally.
Sorry about that. I was only building 32bit wine so I didn't see these warnings.
On Tue Aug 16 12:11:05 2022 +0000, Zhiyi Zhang wrote:
Sorry about that. I was only building 32bit wine so I didn't see these warnings.
Thanks.
This merge request was approved by Nikolay Sivov.
Do we need to make the same changes to user32/edit.c ?
On Tue Aug 16 12:39:08 2022 +0000, Nikolay Sivov wrote:
Do we need to make the same changes to user32/edit.c ?
Yes. I have them and will send them after this MR gets in.