riched20: Handle WM_CHAR's unicode conversion in the host.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-11 08:51:02 +00:00 committed by Alexandre Julliard
parent 21fc1b530d
commit 9fa993022e
2 changed files with 14 additions and 17 deletions

View file

@ -2744,11 +2744,8 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return FALSE;
}
static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
LPARAM flags, BOOL unicode)
static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
{
WCHAR wstr;
if (editor->bMouseCaptured)
return 0;
@ -2758,14 +2755,6 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
return 0; /* FIXME really 0 ? */
}
if (unicode)
wstr = (WCHAR)charCode;
else
{
CHAR charA = charCode;
MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1);
}
if (editor->bEmulateVersion10 && wstr == '\r')
handle_enter(editor);
@ -4379,7 +4368,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
if ((editor->nEventMask & ENM_KEYEVENTS) &&
!ME_FilterEvent(editor, msg, &wParam, &lParam))
return 0;
return ME_Char(editor, wParam, lParam, unicode);
return handle_wm_char( editor, wParam, lParam );
case WM_UNICHAR:
if (unicode)
{
@ -4389,11 +4378,11 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
if(wParam > 0xffff) /* convert to surrogates */
{
wParam -= 0x10000;
ME_Char(editor, (wParam >> 10) + 0xd800, 0, TRUE);
ME_Char(editor, (wParam & 0x03ff) + 0xdc00, 0, TRUE);
} else {
ME_Char(editor, wParam, 0, TRUE);
handle_wm_char( editor, (wParam >> 10) + 0xd800, 0 );
handle_wm_char( editor, (wParam & 0x03ff) + 0xdc00, 0 );
}
else
handle_wm_char( editor, wParam, 0 );
}
return 0;
}

View file

@ -780,6 +780,14 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
editor = host->editor;
switch (msg)
{
case WM_CHAR:
{
WCHAR wc = wparam;
if (!unicode) MultiByteToWideChar( CP_ACP, 0, (char *)&wparam, 1, &wc, 1 );
hr = ITextServices_TxSendMessage( host->text_srv, msg, wc, lparam, &res );
break;
}
case WM_DESTROY:
ITextHost_Release( &host->ITextHost_iface );
return 0;