From: Torge Matthies tmatthies@codeweavers.com
Signed-off-by: Torge Matthies tmatthies@codeweavers.com --- dlls/winex11.drv/ime.c | 6 ++++-- dlls/winex11.drv/unixlib.h | 5 +++++ dlls/winex11.drv/xim.c | 10 +++++----- 3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index 9c0894717ad..5d4d4e031cd 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -924,9 +924,10 @@ NTSTATUS WINAPI x11drv_ime_set_composition_string( void *param, ULONG size ) return ImeSetCompositionString(FROM_X11, SCS_SETSTR, param, size, NULL, 0); }
-NTSTATUS WINAPI x11drv_ime_set_result( void *params, ULONG len ) +NTSTATUS WINAPI x11drv_ime_set_result( void *arg, ULONG len ) { - WCHAR *lpResult = params; + struct ime_set_result_params *params = arg; + WCHAR *lpResult = params->data; HIMC imc; LPINPUTCONTEXT lpIMC; HIMCC newCompStr; @@ -934,6 +935,7 @@ NTSTATUS WINAPI x11drv_ime_set_result( void *params, ULONG len ) BOOL inComp; HWND focus;
+ len -= FIELD_OFFSET( struct ime_set_result_params, data[0] ); len /= sizeof(WCHAR); if ((focus = GetFocus())) x11drv_ime_update_association( HandleToUlong( focus )); diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index e7838d43569..10cfe82cc51 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -136,3 +136,8 @@ struct systray_change_owner_params { UINT64 event_handle; }; + +struct ime_set_result_params +{ + WCHAR data[1]; +}; diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 9f238e0cb83..ef1ef515047 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -117,16 +117,16 @@ static void X11DRV_ImmSetInternalString(UINT offset, UINT selLength, LPWSTR lpCo
void X11DRV_XIMLookupChars( const char *str, UINT count ) { - WCHAR *output; + struct ime_set_result_params *params; DWORD len;
TRACE("%p %u\n", str, count);
- if (!(output = malloc( count * sizeof(WCHAR) ))) return; - len = ntdll_umbstowcs( str, count, output, count ); + if (!(params = malloc( FIELD_OFFSET( struct ime_set_result_params, data[count] ) ))) return; + len = ntdll_umbstowcs( str, count, params->data, count );
- x11drv_client_func( client_func_ime_set_result, output, len * sizeof(WCHAR) ); - free( output ); + x11drv_client_func( client_func_ime_set_result, params, FIELD_OFFSET( struct ime_set_result_params, data[len] ) ); + free( params ); }
static BOOL xic_preedit_state_notify( XIC xic, XPointer user, XPointer arg )