imm32: Improve ImmIsUIMessage

André Hentschel nerv at dawncrow.de
Mon Jun 6 15:28:28 CDT 2011


---
 dlls/imm32/imm.c |   50 ++++++++++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index cc68305..8570739 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -1875,15 +1875,10 @@ BOOL WINAPI ImmIsIME(HKL hKL)
     return (ptr && ptr->hIME);
 }
 
-/***********************************************************************
- *		ImmIsUIMessageA (IMM32.@)
- */
-BOOL WINAPI ImmIsUIMessageA(
-  HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
+BOOL WINAPI IMM_IsUIMessage(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 {
     BOOL rc = FALSE;
 
-    TRACE("(%p, %x, %ld, %ld)\n", hWndIME, msg, wParam, lParam);
     if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
         (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP) ||
         (msg == WM_MSIME_SERVICE) ||
@@ -1893,13 +1888,21 @@ BOOL WINAPI ImmIsUIMessageA(
         (msg == WM_MSIME_RECONVERT) ||
         (msg == WM_MSIME_QUERYPOSITION) ||
         (msg == WM_MSIME_DOCUMENTFEED))
-
     {
-        if (!IMM_GetThreadData()->hwndDefault)
-            ImmGetDefaultIMEWnd(NULL);
-
         if (hWndIME == NULL)
-            PostMessageA(IMM_GetThreadData()->hwndDefault, msg, wParam, lParam);
+        {
+            if (unicode)
+                PostMessageW(ImmGetDefaultIMEWnd(NULL), msg, wParam, lParam);
+            else
+                PostMessageA(ImmGetDefaultIMEWnd(NULL), msg, wParam, lParam);
+        }
+        else
+        {
+            if (unicode)
+                SendMessageW(hWndIME, msg, wParam, lParam);
+            else
+                SendMessageA(hWndIME, msg, wParam, lParam);
+        }
 
         rc = TRUE;
     }
@@ -1907,24 +1910,23 @@ BOOL WINAPI ImmIsUIMessageA(
 }
 
 /***********************************************************************
+ *		ImmIsUIMessageA (IMM32.@)
+ */
+BOOL WINAPI ImmIsUIMessageA(
+  HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    TRACE("(%p, %x, %ld, %ld)\n", hWndIME, msg, wParam, lParam);
+    return IMM_IsUIMessage(hWndIME, msg, wParam, lParam, FALSE);
+}
+
+/***********************************************************************
  *		ImmIsUIMessageW (IMM32.@)
  */
 BOOL WINAPI ImmIsUIMessageW(
   HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    BOOL rc = FALSE;
-    TRACE("(%p, %d, %ld, %ld):\n", hWndIME, msg, wParam, lParam);
-    if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
-        (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP) ||
-        (msg == WM_MSIME_SERVICE) ||
-        (msg == WM_MSIME_RECONVERTOPTIONS) ||
-        (msg == WM_MSIME_MOUSE) ||
-        (msg == WM_MSIME_RECONVERTREQUEST) ||
-        (msg == WM_MSIME_RECONVERT) ||
-        (msg == WM_MSIME_QUERYPOSITION) ||
-        (msg == WM_MSIME_DOCUMENTFEED))
-        rc = TRUE;
-    return rc;
+    TRACE("(%p, %x, %ld, %ld)\n", hWndIME, msg, wParam, lParam);
+    return IMM_IsUIMessage(hWndIME, msg, wParam, lParam, TRUE);
 }
 
 /***********************************************************************
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list