winemac.drv: Use NI_COMPOSITIONSTR/CPS_CANCEL when composition string is empty.

This sends the expected WM_IME_ENDCOMPOSITION message.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aric Stewart 2019-05-24 09:07:55 -05:00 committed by Alexandre Julliard
parent e33ce7c538
commit 6d05fae6f7
1 changed files with 17 additions and 15 deletions

View File

@ -901,6 +901,7 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp,
DWORD flags = 0; DWORD flags = 0;
WCHAR wParam = 0; WCHAR wParam = 0;
LPIMEPRIVATE myPrivate; LPIMEPRIVATE myPrivate;
BOOL sendMessage = TRUE;
TRACE("(%p, %d, %p, %d):\n", hIMC, dwIndex, lpComp, dwCompLen); TRACE("(%p, %d, %p, %d):\n", hIMC, dwIndex, lpComp, dwCompLen);
@ -943,13 +944,6 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp,
wParam = ((const WCHAR*)lpComp)[0]; wParam = ((const WCHAR*)lpComp)[0];
flags |= GCS_COMPCLAUSE | GCS_COMPATTR | GCS_DELTASTART; flags |= GCS_COMPCLAUSE | GCS_COMPATTR | GCS_DELTASTART;
}
else
{
newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0, &flags);
ImmDestroyIMCC(lpIMC->hCompStr);
lpIMC->hCompStr = newCompStr;
}
if (cursor_valid) if (cursor_valid)
{ {
@ -959,12 +953,20 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp,
ImmUnlockIMCC(lpIMC->hCompStr); ImmUnlockIMCC(lpIMC->hCompStr);
flags |= GCS_CURSORPOS; flags |= GCS_CURSORPOS;
} }
}
else
{
NotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
sendMessage = FALSE;
}
} }
if (sendMessage) {
GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags); GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags);
ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMCC(lpIMC->hPrivate);
UnlockRealIMC(hIMC); UnlockRealIMC(hIMC);
}
return TRUE; return TRUE;
} }