https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3820744a18cc4ea1b2a44d6c07f03c154f7e2796

commit 3820744a18cc4ea1b2a44d6c07f03c154f7e2796
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Fri Apr 15 13:16:50 2022 +0900
Commit:     GitHub <[email protected]>
CommitDate: Fri Apr 15 13:16:50 2022 +0900

    [NTUSER][IMM32_APITEST] Associate HIMC to WND (#4451)
    
    - Set the default input context to WND at IntCreateWindow function.
    - Add more tests to the himc testcase of imm32_apitest.
    CORE-11700
---
 modules/rostests/apitests/imm32/himc.c | 43 +++++++++++++++++++++++++++++++++-
 win32ss/user/ntuser/window.c           |  4 ++++
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/apitests/imm32/himc.c 
b/modules/rostests/apitests/imm32/himc.c
index 050bd324e10..d2e7104ba24 100644
--- a/modules/rostests/apitests/imm32/himc.c
+++ b/modules/rostests/apitests/imm32/himc.c
@@ -7,7 +7,7 @@
 
 #include "precomp.h"
 
-START_TEST(himc)
+static void Test1(void)
 {
     DWORD style;
     HWND hwndEdit, hwndStatic;
@@ -152,3 +152,44 @@ START_TEST(himc)
     DestroyWindow(hwndEdit);
     DestroyWindow(hwndStatic);
 }
+
+static void Test2(void)
+{
+    static const LPCSTR apszClasses[] =
+    {
+        "BUTTON",
+        "COMBOBOX",
+        "EDIT",
+        "LISTBOX",
+        "SCROLLBAR",
+        "STATIC"
+    };
+    size_t i;
+    HIMC hIMC;
+    HWND hwnd;
+
+    for (i = 0; i < _countof(apszClasses); ++i)
+    {
+        LPCSTR pszClass = apszClasses[i];
+        hwnd = CreateWindowA(pszClass, NULL, WS_VISIBLE, 0, 0, 0, 0, NULL, 
NULL,
+                             GetModuleHandle(NULL), NULL);
+        ok(hwnd != NULL, "CreateWindow failed\n");
+
+        hIMC = ImmGetContext(hwnd);
+
+        if (lstrcmpiA(pszClass, "BUTTON") == 0)
+            ok(hIMC == NULL, "hIMC was %p\n", hIMC);
+        else
+            ok(hIMC != NULL, "hIMC was NULL\n");
+
+        ImmReleaseContext(hwnd, hIMC);
+
+        DestroyWindow(hwnd);
+    }
+}
+
+START_TEST(himc)
+{
+    Test1();
+    Test2();
+}
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index 3cf1fd22a99..025e80e578f 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -1866,6 +1866,10 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
    pWnd->ExStyle = Cs->dwExStyle;
    pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
    pWnd->pActCtx = acbiBuffer;
+
+   if (pti->spDefaultImc && Class->atomClassName != 
gpsi->atomSysClass[ICLS_BUTTON])
+      pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
+
    pWnd->InternalPos.MaxPos.x  = pWnd->InternalPos.MaxPos.y  = -1;
    pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
 

Reply via email to