[PATCH v4 1/3] winex11.drv: introduce X11DRV_FindXIC() and update X11DRV_ForceXIMReset()

Alex Kwak take-me-home at kakao.com
Sat Apr 2 09:39:23 CDT 2022


HWND used in X11DRV_ForceXIMReset() is not the HWND in which the XIC is
created, but the HWND belonging to the child. So, it doesn't work call
this function.

Therefore, introduce X11DRV_FindXIC() for finding nearest XIC. this
function finds the already created XIC in itself and parents.

Signed-off-by: Alex Kwak <take-me-home at kakao.com>
---
 dlls/winex11.drv/x11drv.h |  1 +
 dlls/winex11.drv/xim.c    | 25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index f389f3e0836..1d181b76295 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -827,6 +827,7 @@ extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN;
 extern XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) DECLSPEC_HIDDEN;
 extern void X11DRV_SetupXIM(void) DECLSPEC_HIDDEN;
 extern void X11DRV_XIMLookupChars( const char *str, DWORD count ) DECLSPEC_HIDDEN;
+extern XIC X11DRV_FindXIC(HWND hwnd) DECLSPEC_HIDDEN;
 extern void X11DRV_ForceXIMReset(HWND hwnd) DECLSPEC_HIDDEN;
 extern void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen) DECLSPEC_HIDDEN;
 
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c
index 3994c2106cc..5dab82182d6 100644
--- a/dlls/winex11.drv/xim.c
+++ b/dlls/winex11.drv/xim.c
@@ -249,9 +249,32 @@ static void XIMPreEditCaretCallback(XIC ic, XPointer client_data,
     TRACE("Finished\n");
 }
 
+/**
+ * X11DRV_FindXIC
+ *
+ * This function finds the already created XIC in itself and parents.
+ * If only the specified handle is get via X11DRV_get_ic, the XIC can be exists
+ * in the parents and cannot be get.
+ */
+XIC X11DRV_FindXIC(HWND hwnd)
+{
+    XIC ic = NULL;
+
+    while (hwnd)
+    {
+        ic = get_win_data(hwnd)->xic;
+        if (ic)
+            break;
+        else
+            hwnd = GetParent(hwnd);
+    }
+
+    return ic;
+}
+
 void X11DRV_ForceXIMReset(HWND hwnd)
 {
-    XIC ic = X11DRV_get_ic(hwnd);
+    XIC ic = X11DRV_FindXIC(hwnd);
     if (ic)
     {
         char* leftover;
-- 
2.32.0




More information about the wine-devel mailing list