Module: wine Branch: master Commit: 6d05fae6f7ebab83a2f1c6621d9619bbe91833fd URL: https://source.winehq.org/git/wine.git/?a=commit;h=6d05fae6f7ebab83a2f1c6621...
Author: Aric Stewart aric@codeweavers.com Date: Fri May 24 09:07:55 2019 -0500
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
---
dlls/winemac.drv/ime.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 1f5cb6b..a071408 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -901,6 +901,7 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD flags = 0; WCHAR wParam = 0; LPIMEPRIVATE myPrivate; + BOOL sendMessage = TRUE;
TRACE("(%p, %d, %p, %d):\n", hIMC, dwIndex, lpComp, dwCompLen);
@@ -943,28 +944,29 @@ static BOOL IME_SetCompositionString(void* hIMC, DWORD dwIndex, LPCVOID lpComp,
wParam = ((const WCHAR*)lpComp)[0]; 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 { - newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0, &flags); - ImmDestroyIMCC(lpIMC->hCompStr); - lpIMC->hCompStr = newCompStr; - } - - if (cursor_valid) - { - LPCOMPOSITIONSTRING compstr; - compstr = ImmLockIMCC(lpIMC->hCompStr); - compstr->dwCursorPos = cursor_pos; - ImmUnlockIMCC(lpIMC->hCompStr); - flags |= GCS_CURSORPOS; + NotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0); + sendMessage = FALSE; }
}
- GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags); - ImmUnlockIMCC(lpIMC->hPrivate); - UnlockRealIMC(hIMC); + if (sendMessage) { + GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags); + ImmUnlockIMCC(lpIMC->hPrivate); + UnlockRealIMC(hIMC); + }
return TRUE; }