Piotr Caban : imm32: Only call ImmSetActiveContext for focused window in ImmAssociateContext.
Alexandre Julliard
julliard at winehq.org
Mon Oct 18 16:16:30 CDT 2021
Module: wine
Branch: master
Commit: f84d88d44ae377f91d8586937cd365db29558e62
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f84d88d44ae377f91d8586937cd365db29558e62
Author: Piotr Caban <piotr at codeweavers.com>
Date: Sat Oct 16 21:21:18 2021 +0200
imm32: Only call ImmSetActiveContext for focused window in ImmAssociateContext.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/imm32/imm.c | 2 +-
dlls/imm32/tests/imm32.c | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 1230c2e2b95..fa2399487a4 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -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);
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 1d2ae6dd0a1..cb49478e390 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -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);
More information about the wine-cvs
mailing list