static void XIMPreEditDrawCallback(XIM ic, XPointer client_data, XIMPreeditDrawCallbackStruct *P_DR) { TRACE("PreEditDrawCallback %p\n",ic); if (P_DR) { int sel = P_DR->chg_first; int len = P_DR->chg_length; if (P_DR->text) { if (! P_DR->text->encoding_is_wchar) { DWORD dwOutput; WCHAR *wcOutput; TRACE("multibyte\n"); dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, P_DR->text->string.multi_byte, -1, NULL, 0); wcOutput = HeapAlloc(GetProcessHeap(), 0, sizeof (WCHAR) * dwOutput); if (wcOutput) { dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, P_DR->text->string.multi_byte, -1, wcOutput, dwOutput); /* ignore null */ dwOutput --; X11DRV_ImmSetInternalString (GCS_COMPSTR, sel, len, wcOutput, dwOutput); HeapFree(GetProcessHeap(), 0, wcOutput); } } else { FIXME("wchar PROBIBILY WRONG\n"); X11DRV_ImmSetInternalString (GCS_COMPSTR, sel, len, (LPWSTR)P_DR->text->string.wide_char, P_DR->text->length); } } else X11DRV_ImmSetInternalString (GCS_COMPSTR, sel, len, NULL, 0); IME_SetCursorPos(P_DR->caret); } TRACE("Finished\n"); }
void X11DRV_XIMLookupChars( const char *str, DWORD count ) { DWORD dwOutput; WCHAR wcOutput[64]; HWND focus; dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, str, count, wcOutput, sizeof(wcOutput)/sizeof(WCHAR)); if ((focus = GetFocus())) IME_UpdateAssociation(focus); X11DRV_ImmSetInternalString(GCS_RESULTSTR,0,0,wcOutput,dwOutput); }
void X11DRV_XIMLookupChars( const char *str, DWORD count ) { DWORD dwOutput; WCHAR *wcOutput; HWND focus; 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); }