 
            From: Bernhard Kölbl bkoelbl@codeweavers.com
--- dlls/winex11.drv/keyboard.c | 8 ++++---- dlls/winex11.drv/xim.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 25836fe835d..af202e2e082 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1357,11 +1357,11 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) release_win_data( data ); }
- /* Clients should pass only KeyPress events to XmbLookupString */ + /* Clients should pass only KeyPress events to Xutf8LookupString */ if (xic && event->type == KeyPress) { - ascii_chars = XmbLookupString(xic, event, buf, sizeof(buf), &keysym, &status); - TRACE_(key)("XmbLookupString needs %i byte(s)\n", ascii_chars); + ascii_chars = Xutf8LookupString( xic, event, buf, sizeof(buf), &keysym, &status ); + TRACE_(key)("Xutf8LookupString needs %i byte(s)\n", ascii_chars); if (status == XBufferOverflow) { Str = malloc( ascii_chars ); @@ -1370,7 +1370,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) ERR_(key)("Failed to allocate memory!\n"); return FALSE; } - ascii_chars = XmbLookupString(xic, event, Str, ascii_chars, &keysym, &status); + ascii_chars = Xutf8LookupString( xic, event, Str, ascii_chars, &keysym, &status ); } } else diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index ef09356fbb0..29970bb57bf 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -104,14 +104,15 @@ static void xim_update_comp_string( UINT offset, UINT old_len, const WCHAR *text
void xim_set_result_string( HWND hwnd, const char *str, UINT count ) { + const DWORD buf_len = (count + 1) * sizeof(WCHAR); WCHAR *output; DWORD len;
TRACE( "hwnd %p, string %s\n", hwnd, debugstr_an(str, count) );
- if (!(output = malloc( (count + 1) * sizeof(WCHAR) ))) return; - len = ntdll_umbstowcs( str, count, output, count ); - output[len] = 0; + if (!(output = malloc( buf_len ))) return; + RtlUTF8ToUnicodeN( output, buf_len, &len, str, count ); + output[len/sizeof(WCHAR)] = 0;
post_ime_update( hwnd, 0, NULL, output );