imm32: Only call ImmSetActiveContext for active window in ImmAssociateContext.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e6d53d6301
commit
01e072bb68
|
@ -592,12 +592,6 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
|
||||||
if (!IsWindow(hWnd) || (hIMC && !data))
|
if (!IsWindow(hWnd) || (hIMC && !data))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/*
|
|
||||||
* If already associated just return
|
|
||||||
*/
|
|
||||||
if (hIMC && data->IMC.hWnd == hWnd)
|
|
||||||
return hIMC;
|
|
||||||
|
|
||||||
if (hIMC && IMM_IsCrossThreadAccess(hWnd, hIMC))
|
if (hIMC && IMM_IsCrossThreadAccess(hWnd, hIMC))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -608,6 +602,7 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
|
||||||
else if (old == (HIMC)-1)
|
else if (old == (HIMC)-1)
|
||||||
old = NULL;
|
old = NULL;
|
||||||
|
|
||||||
|
/* If already associated just return */
|
||||||
if (old == hIMC)
|
if (old == hIMC)
|
||||||
return hIMC;
|
return hIMC;
|
||||||
|
|
||||||
|
@ -618,8 +613,11 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
|
||||||
else
|
else
|
||||||
SetPropW(hWnd, szwWineIMCProperty, hIMC);
|
SetPropW(hWnd, szwWineIMCProperty, hIMC);
|
||||||
|
|
||||||
|
if (GetActiveWindow() == hWnd)
|
||||||
|
{
|
||||||
ImmSetActiveContext(hWnd, old, FALSE);
|
ImmSetActiveContext(hWnd, old, FALSE);
|
||||||
ImmSetActiveContext(hWnd, hIMC, TRUE);
|
ImmSetActiveContext(hWnd, hIMC, TRUE);
|
||||||
|
}
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -662,6 +662,7 @@ static void test_ImmAssociateContextEx(void)
|
||||||
if (imc)
|
if (imc)
|
||||||
{
|
{
|
||||||
HIMC retimc, newimc;
|
HIMC retimc, newimc;
|
||||||
|
HWND focus;
|
||||||
|
|
||||||
SET_ENABLE(WM_IME_SETCONTEXT_ACTIVATE, TRUE);
|
SET_ENABLE(WM_IME_SETCONTEXT_ACTIVATE, TRUE);
|
||||||
SET_ENABLE(WM_IME_SETCONTEXT_DEACTIVATE, TRUE);
|
SET_ENABLE(WM_IME_SETCONTEXT_DEACTIVATE, TRUE);
|
||||||
|
@ -703,11 +704,19 @@ static void test_ImmAssociateContextEx(void)
|
||||||
ok(retimc == newimc, "handles should be the same\n");
|
ok(retimc == newimc, "handles should be the same\n");
|
||||||
ImmReleaseContext(hwnd,retimc);
|
ImmReleaseContext(hwnd,retimc);
|
||||||
|
|
||||||
|
focus = CreateWindowA("button", "button", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
ok(focus != NULL, "CreateWindow failed\n");
|
||||||
SET_EXPECT(WM_IME_SETCONTEXT_DEACTIVATE);
|
SET_EXPECT(WM_IME_SETCONTEXT_DEACTIVATE);
|
||||||
|
SetFocus(focus);
|
||||||
|
todo_wine CHECK_CALLED(WM_IME_SETCONTEXT_DEACTIVATE);
|
||||||
|
rc = pImmAssociateContextEx(hwnd, imc, 0);
|
||||||
|
ok(rc, "ImmAssociateContextEx failed\n");
|
||||||
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
|
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
|
||||||
|
DestroyWindow(focus);
|
||||||
|
todo_wine CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE);
|
||||||
|
SetFocus(hwnd);
|
||||||
|
|
||||||
rc = pImmAssociateContextEx(hwnd, NULL, IACE_DEFAULT);
|
rc = pImmAssociateContextEx(hwnd, NULL, IACE_DEFAULT);
|
||||||
CHECK_CALLED(WM_IME_SETCONTEXT_DEACTIVATE);
|
|
||||||
CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE);
|
|
||||||
ok(rc, "ImmAssociateContextEx failed\n");
|
ok(rc, "ImmAssociateContextEx failed\n");
|
||||||
|
|
||||||
SET_ENABLE(WM_IME_SETCONTEXT_ACTIVATE, FALSE);
|
SET_ENABLE(WM_IME_SETCONTEXT_ACTIVATE, FALSE);
|
||||||
|
|
Loading…
Reference in New Issue