From: Byeongsik Jeon bsjeon@hanmail.net
This patch fixes a Japanese input issue in MS Office Visual Basic and Mery text editor ime inline mode. The following was considered:
1. Japanese ime: the result string message is always placed between WM_IME_STARTCOMPOSITION and WM_IME_ENDCOMPOSITION. Currently in Wine, the result string message follows WM_IME_ENDCOMPOSITION.
dlls/imm32/tests/imm32.c::test_nihongo_no().
2. Chinese ime: same as Japanese ime.
3. Korean ime: mostly the same, but there are some cases where it is not (e.g. CPS_COMPLETE, 'r-k-RETURN'). However, I haven't found any problem even if it behave like Japanese ime message order.
3. zero-length preedit string: as in MR !3115 commit d1f9aae, the message followed by WM_IME_ENDCOMPOSITION. Currently in Wine, it is associated with WM_IME_STARTCOMPOSITION.
4. zero-length result string: ignore. --- dlls/imm32/ime.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c index d7ffc3de115..5d4c92f99c9 100644 --- a/dlls/imm32/ime.c +++ b/dlls/imm32/ime.c @@ -561,14 +561,17 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs, if (status) WARN( "WINE_IME_TO_ASCII_EX returned status %#lx\n", status ); else { - TRANSMSG status_msg = {.message = ime_set_composition_status( himc, !!compstr->dwCompStrOffset )}; - if (status_msg.message) msgs->TransMsg[count++] = status_msg; + if (compstr->dwCompStrLen || compstr->dwResultStrLen) + { + TRANSMSG msg = {.message = ime_set_composition_status( himc, TRUE )}; + if (msg.message == WM_IME_STARTCOMPOSITION) msgs->TransMsg[count++] = msg; + }
- if (compstr->dwResultStrOffset) + if (compstr->dwResultStrLen) { const WCHAR *result = (WCHAR *)((BYTE *)compstr + compstr->dwResultStrOffset); TRANSMSG msg = {.message = WM_IME_COMPOSITION, .wParam = result[0], .lParam = GCS_RESULTSTR}; - if (compstr->dwResultClauseOffset) msg.lParam |= GCS_RESULTCLAUSE; + if (compstr->dwResultClauseLen) msg.lParam |= GCS_RESULTCLAUSE; msgs->TransMsg[count++] = msg; }
@@ -582,6 +585,12 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs, msgs->TransMsg[count++] = msg; }
+ if (!compstr->dwCompStrLen) + { + TRANSMSG msg = {.message = ime_set_composition_status( himc, FALSE )}; + if (msg.message == WM_IME_ENDCOMPOSITION) msgs->TransMsg[count++] = msg; + } + if (!key_consumed) { TRANSMSG msg = {.message = WM_IME_KEYDOWN, .wParam = vkey, .lParam = vsc};