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@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;
HWND used in X11DRV_SetPreeditState() 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, call X11DRV_FindXIC() instead X11DRV_get_ic().
Signed-off-by: Alex Kwak take-me-home@kakao.com --- dlls/winex11.drv/xim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 5dab82182d6..f7a266c813a 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -290,7 +290,7 @@ void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen) XIMPreeditState state; XVaNestedList attr;
- ic = X11DRV_get_ic(hwnd); + ic = X11DRV_FindXIC(hwnd); if (!ic) return;
The composition on the IME message is end, but the XIM string is in-composition state, and the same string remains on the XIM afterwards. so, call X11DRV_ForceXIMReset and finish composition state in the XIM.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52754 Signed-off-by: Alex Kwak take-me-home@kakao.com --- v2: When XmbResetIC is called and KeyEvent occurs, it is a problem with some IME (i.e., ibus-hangul). v3: implement X11DRV_FindXIC(..) for getting exists XIC. v4: Split the patches --- dlls/winex11.drv/ime.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index c1584930861..2fe78234671 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -753,6 +753,8 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) myPrivate->bInComposition = FALSE; ImmUnlockIMCC(lpIMC->hPrivate);
+ X11DRV_ForceXIMReset(lpIMC->hWnd); + bRet = TRUE; } break;