winex11.drv: Make X11DRV_XIMLookupChars handle a long string properly.

This commit is contained in:
Muneyuki Noguchi 2008-09-13 15:01:40 +09:00 committed by Alexandre Julliard
parent 8af99c9751
commit f8446f2606
1 changed files with 7 additions and 2 deletions

View File

@ -177,15 +177,20 @@ static BOOL X11DRV_ImmSetInternalString(DWORD dwIndex, DWORD dwOffset,
void X11DRV_XIMLookupChars( const char *str, DWORD count )
{
DWORD dwOutput;
WCHAR wcOutput[64];
WCHAR *wcOutput;
HWND focus;
dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, str, count, wcOutput, sizeof(wcOutput)/sizeof(WCHAR));
dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, str, count, NULL, 0);
wcOutput = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * dwOutput);
if (wcOutput == NULL)
return;
MultiByteToWideChar(CP_UNIXCP, 0, str, count, wcOutput, dwOutput);
if ((focus = GetFocus()))
IME_UpdateAssociation(focus);
X11DRV_ImmSetInternalString(GCS_RESULTSTR,0,0,wcOutput,dwOutput);
HeapFree(GetProcessHeap(), 0, wcOutput);
}
static void X11DRV_ImmSetOpenStatus(BOOL fOpen)