Commit f84d88d4 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

imm32: Only call ImmSetActiveContext for focused window in ImmAssociateContext.

parent 374ad339
......@@ -771,7 +771,7 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
else
SetPropW(hWnd, szwWineIMCProperty, hIMC);
if (GetActiveWindow() == hWnd)
if (GetFocus() == hWnd)
{
ImmSetActiveContext(hWnd, old, FALSE);
ImmSetActiveContext(hWnd, hIMC, TRUE);
......
......@@ -207,7 +207,7 @@ static void msg_spy_cleanup(void) {
static const char wndcls[] = "winetest_imm32_wndcls";
static enum { PHASE_UNKNOWN, FIRST_WINDOW, SECOND_WINDOW,
CREATE_CANCEL, NCCREATE_CANCEL, IME_DISABLED } test_phase;
static HWND hwnd;
static HWND hwnd, child;
static HWND get_ime_window(void);
......@@ -326,6 +326,10 @@ static BOOL init(void) {
if (!hwnd)
return FALSE;
child = CreateWindowA("edit", "edit", WS_CHILD | WS_VISIBLE, 0, 0, 50, 50, hwnd, 0, 0, 0);
if (!child)
return FALSE;
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
......@@ -726,9 +730,21 @@ static void test_ImmAssociateContextEx(void)
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
DestroyWindow(focus);
CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE);
SET_EXPECT(WM_IME_SETCONTEXT_DEACTIVATE);
SetFocus(child);
CHECK_CALLED(WM_IME_SETCONTEXT_DEACTIVATE);
rc = pImmAssociateContextEx(hwnd, newimc, 0);
ok(rc, "ImmAssociateContextEx failed\n");
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
SetFocus(hwnd);
CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE);
SET_EXPECT(WM_IME_SETCONTEXT_DEACTIVATE);
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
rc = pImmAssociateContextEx(hwnd, NULL, IACE_DEFAULT);
CHECK_CALLED(WM_IME_SETCONTEXT_DEACTIVATE);
CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE);
ok(rc, "ImmAssociateContextEx failed\n");
SET_ENABLE(WM_IME_SETCONTEXT_ACTIVATE, FALSE);
......
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