From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/winex11.drv/keyboard.c | 2 +- dlls/winex11.drv/xim.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 25836fe835d..e2281bef017 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1823,7 +1823,7 @@ void X11DRV_InitKeyboard( Display *display ) */ BOOL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags) { - FIXME("%p, %04x: semi-stub!\n", hkl, flags); + WARN("%p, %04x: semi-stub!\n", hkl, flags); if (flags & KLF_SETFORPROCESS) { diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 05ef7863a8c..b7321afb4c7 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -70,6 +70,12 @@ static const char *debugstr_xim_style( XIMStyle style ) return wine_dbg_sprintf( "%s", buffer ); } +static HKL get_ime_hkl(void) +{ + LCID locale = LOWORD( NtUserGetKeyboardLayout( 0 ) ); + return ULongToHandle( MAKELONG( locale, 0xe001 ) ); +} + BOOL xim_in_compose_mode(void) { return !!ime_comp_buf; @@ -113,6 +119,7 @@ void xim_set_result_string( HWND hwnd, const char *str, UINT count ) len = ntdll_umbstowcs( str, count, output, count ); output[len] = 0; + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); post_ime_update( hwnd, 0, NULL, output ); free( output ); @@ -129,6 +136,7 @@ static BOOL xic_preedit_state_notify( XIC xic, XPointer user, XPointer arg ) switch (state) { case XIMPreeditEnable: + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); NtUserPostMessage( hwnd, WM_WINE_IME_NOTIFY, IMN_WINE_SET_OPEN_STATUS, TRUE ); break; case XIMPreeditDisable: @@ -148,6 +156,7 @@ static int xic_preedit_start( XIC xic, XPointer user, XPointer arg ) if ((ime_comp_buf = realloc( ime_comp_buf, sizeof(WCHAR) ))) *ime_comp_buf = 0; else ERR( "Failed to allocate preedit buffer\n" ); + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); NtUserPostMessage( hwnd, WM_WINE_IME_NOTIFY, IMN_WINE_SET_OPEN_STATUS, TRUE ); post_ime_update( hwnd, 0, ime_comp_buf, NULL ); @@ -163,6 +172,7 @@ static int xic_preedit_done( XIC xic, XPointer user, XPointer arg ) free( ime_comp_buf ); ime_comp_buf = NULL; + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); post_ime_update( hwnd, 0, NULL, NULL ); NtUserPostMessage( hwnd, WM_WINE_IME_NOTIFY, IMN_WINE_SET_OPEN_STATUS, FALSE ); @@ -230,6 +240,7 @@ static int xic_preedit_draw( XIC xic, XPointer user, XPointer arg ) if (text && str != text->string.multi_byte) free( str ); + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); ime_comp_cursor_pos = get_comp_cursor_pos( params ); post_ime_update( hwnd, ime_comp_cursor_pos, ime_comp_buf, NULL ); @@ -282,6 +293,7 @@ static int xic_preedit_caret( XIC xic, XPointer user, XPointer arg ) if (LOWORD( ime_comp_cursor_pos ) == HIWORD( ime_comp_cursor_pos ) && LOWORD( ime_comp_cursor_pos ) != pos) { + NtUserActivateKeyboardLayout( get_ime_hkl(), 0 ); ime_comp_cursor_pos = MAKELONG( pos, pos ); post_ime_update( hwnd, ime_comp_cursor_pos, ime_comp_buf, NULL ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10138