Commit 6d05fae6 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

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

This sends the expected WM_IME_ENDCOMPOSITION message. Signed-off-by: 's avatarAric Stewart <aric@codeweavers.com> Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e33ce7c5
...@@ -901,6 +901,7 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp, ...@@ -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,28 +944,29 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp, ...@@ -943,28 +944,29 @@ 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;
if (cursor_valid)
{
LPCOMPOSITIONSTRING compstr;
compstr = ImmLockIMCC(lpIMC->hCompStr);
compstr->dwCursorPos = cursor_pos;
ImmUnlockIMCC(lpIMC->hCompStr);
flags |= GCS_CURSORPOS;
}
} }
else else
{ {
newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0, &flags); NotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
ImmDestroyIMCC(lpIMC->hCompStr); sendMessage = FALSE;
lpIMC->hCompStr = newCompStr;
}
if (cursor_valid)
{
LPCOMPOSITIONSTRING compstr;
compstr = ImmLockIMCC(lpIMC->hCompStr);
compstr->dwCursorPos = cursor_pos;
ImmUnlockIMCC(lpIMC->hCompStr);
flags |= GCS_CURSORPOS;
} }
} }
GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags); if (sendMessage) {
ImmUnlockIMCC(lpIMC->hPrivate); GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags);
UnlockRealIMC(hIMC); ImmUnlockIMCC(lpIMC->hPrivate);
UnlockRealIMC(hIMC);
}
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment