imm32: Use offsets instead of lengths to decide on sending updates.

The composition or result strings may be present, but with zero length.
In which case we still want to send the messages, to indicate any change
for instance whenever a character is deleted and strings become empty.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55055
This commit is contained in:
Rémi Bernon 2023-06-15 14:56:35 +02:00 committed by Alexandre Julliard
parent d1f9aae599
commit e564619172

View file

@ -559,7 +559,7 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs,
TRANSMSG status_msg = {.message = ime_set_composition_status( himc, !!compstr->dwCompStrOffset )};
if (status_msg.message) msgs->TransMsg[count++] = status_msg;
if (compstr->dwResultStrLen)
if (compstr->dwResultStrOffset)
{
const WCHAR *result = (WCHAR *)((BYTE *)compstr + compstr->dwResultStrOffset);
TRANSMSG msg = {.message = WM_IME_COMPOSITION, .wParam = result[0], .lParam = GCS_RESULTSTR};
@ -567,7 +567,7 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs,
msgs->TransMsg[count++] = msg;
}
if (compstr->dwCompStrLen)
if (compstr->dwCompStrOffset)
{
const WCHAR *comp = (WCHAR *)((BYTE *)compstr + compstr->dwCompStrOffset);
TRANSMSG msg = {.message = WM_IME_COMPOSITION, .wParam = comp[0], .lParam = GCS_COMPSTR | GCS_CURSORPOS | GCS_DELTASTART};