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) ...@@ -771,7 +771,7 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
else else
SetPropW(hWnd, szwWineIMCProperty, hIMC); SetPropW(hWnd, szwWineIMCProperty, hIMC);
if (GetActiveWindow() == hWnd) if (GetFocus() == hWnd)
{ {
ImmSetActiveContext(hWnd, old, FALSE); ImmSetActiveContext(hWnd, old, FALSE);
ImmSetActiveContext(hWnd, hIMC, TRUE); ImmSetActiveContext(hWnd, hIMC, TRUE);
......
...@@ -207,7 +207,7 @@ static void msg_spy_cleanup(void) { ...@@ -207,7 +207,7 @@ static void msg_spy_cleanup(void) {
static const char wndcls[] = "winetest_imm32_wndcls"; static const char wndcls[] = "winetest_imm32_wndcls";
static enum { PHASE_UNKNOWN, FIRST_WINDOW, SECOND_WINDOW, static enum { PHASE_UNKNOWN, FIRST_WINDOW, SECOND_WINDOW,
CREATE_CANCEL, NCCREATE_CANCEL, IME_DISABLED } test_phase; CREATE_CANCEL, NCCREATE_CANCEL, IME_DISABLED } test_phase;
static HWND hwnd; static HWND hwnd, child;
static HWND get_ime_window(void); static HWND get_ime_window(void);
...@@ -326,6 +326,10 @@ static BOOL init(void) { ...@@ -326,6 +326,10 @@ static BOOL init(void) {
if (!hwnd) if (!hwnd)
return FALSE; 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); ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd); UpdateWindow(hwnd);
...@@ -726,9 +730,21 @@ static void test_ImmAssociateContextEx(void) ...@@ -726,9 +730,21 @@ static void test_ImmAssociateContextEx(void)
SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE); SET_EXPECT(WM_IME_SETCONTEXT_ACTIVATE);
DestroyWindow(focus); DestroyWindow(focus);
CHECK_CALLED(WM_IME_SETCONTEXT_ACTIVATE); 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); 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); 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);
......
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