From: Byeongsik Jeon <bsjeon(a)hanmail.net> --- dlls/winex11.drv/xim.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 1b2abb8e92b..32c7f12a67c 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -45,6 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(xim); #endif static WCHAR *ime_comp_buf; +static DWORD ime_comp_cursor_pos = 0; static XIMStyle input_style = 0; static XIMStyle input_style_req = XIMPreeditCallbacks | XIMStatusCallbacks; @@ -229,14 +230,14 @@ static int xic_preedit_draw( XIC xic, XPointer user, XPointer arg ) if (text && str != text->string.multi_byte) free( str ); - post_ime_update( hwnd, get_comp_cursor_pos( params ), ime_comp_buf, NULL ); + ime_comp_cursor_pos = get_comp_cursor_pos( params ); + post_ime_update( hwnd, ime_comp_cursor_pos, ime_comp_buf, NULL ); return 0; } static int xic_preedit_caret( XIC xic, XPointer user, XPointer arg ) { - static int xim_caret_pos; XIMPreeditCaretCallbackStruct *params = (void *)arg; HWND hwnd = (HWND)user; int pos; @@ -245,7 +246,7 @@ static int xic_preedit_caret( XIC xic, XPointer user, XPointer arg ) if (!params) return 0; - pos = xim_caret_pos; + pos = LOWORD( ime_comp_cursor_pos ); switch (params->direction) { case XIMForwardChar: @@ -273,9 +274,17 @@ static int xic_preedit_caret( XIC xic, XPointer user, XPointer arg ) FIXME( "Not implemented\n" ); break; } - params->position = xim_caret_pos = pos; + params->position = pos; - post_ime_update( hwnd, MAKELONG( pos, pos ), ime_comp_buf, NULL ); + /* uim implements the preedit_caret callback. This callback is only + valid when the xim is in non-conversion state (ATTR_INPUT). + */ + if (LOWORD( ime_comp_cursor_pos ) == HIWORD( ime_comp_cursor_pos ) && + LOWORD( ime_comp_cursor_pos ) != pos) + { + ime_comp_cursor_pos = MAKEWORD( pos, pos ); + post_ime_update( hwnd, ime_comp_cursor_pos, ime_comp_buf, NULL ); + } return 0; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7812