winex11.drv: Improve setting IME result text with no composition.

This greatly improves behaviors around deadkeys in Microsoft Word.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aric Stewart 2016-04-22 13:59:03 -05:00 committed by Alexandre Julliard
parent 881fd6a565
commit e4d94e4813
1 changed files with 19 additions and 5 deletions

View File

@ -1046,24 +1046,38 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen)
LPINPUTCONTEXT lpIMC;
HIMCC newCompStr;
LPIMEPRIVATE myPrivate;
BOOL inComp;
imc = RealIMC(FROM_X11);
lpIMC = ImmLockIMC(imc);
if (lpIMC == NULL)
return;
newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0);
ImmDestroyIMCC(lpIMC->hCompStr);
lpIMC->hCompStr = newCompStr;
newCompStr = updateResultStr(lpIMC->hCompStr, lpResult, dwResultLen);
ImmDestroyIMCC(lpIMC->hCompStr);
lpIMC->hCompStr = newCompStr;
myPrivate = ImmLockIMCC(lpIMC->hPrivate);
if (!myPrivate->bInComposition)
GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0);
GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_RESULTSTR);
if (!myPrivate->bInComposition)
GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0);
inComp = myPrivate->bInComposition;
ImmUnlockIMCC(lpIMC->hPrivate);
if (!inComp)
{
ImmSetOpenStatus(imc, TRUE);
GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0);
}
GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR);
GenerateIMEMessage(imc, WM_IME_COMPOSITION, lpResult[0], GCS_RESULTSTR|GCS_RESULTCLAUSE);
GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0);
if (!inComp)
ImmSetOpenStatus(imc, FALSE);
ImmUnlockIMC(imc);
}