Module: wine Branch: master Commit: 8724c37c7b9626a728ae95c91911002a28bb3a77 URL: https://source.winehq.org/git/wine.git/?a=commit;h=8724c37c7b9626a728ae95c91...
Author: Huw Davies huw@codeweavers.com Date: Wed Mar 17 08:45:28 2021 +0000
riched20: Set the window title in the host.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/riched20/editor.c | 55 +++++++++++++++---------------------------------- dlls/riched20/editor.h | 4 ++-- dlls/riched20/txthost.c | 23 ++++++++++++++++++--- dlls/riched20/txtsrv.c | 16 +++++++------- 4 files changed, 47 insertions(+), 51 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 779472f1f04..13a04a003f4 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3207,16 +3207,10 @@ static void ME_SetText(ME_TextEditor *editor, void *text, BOOL unicode) ME_EndToUnicode(codepage, wszText); }
-static LRESULT ME_WmCreate(ME_TextEditor *editor, LPARAM lParam, BOOL unicode) +static LRESULT ME_WmCreate( ME_TextEditor *editor ) { - CREATESTRUCTW *createW = (CREATESTRUCTW*)lParam; - CREATESTRUCTA *createA = (CREATESTRUCTA*)lParam; - void *text = NULL; INT max;
- if (lParam) - text = unicode ? (void*)createW->lpszName : (void*)createA->lpszName; - max = (editor->scrollbars & ES_DISABLENOSCROLL) ? 1 : 0; if (~editor->scrollbars & ES_DISABLENOSCROLL || editor->scrollbars & WS_VSCROLL) ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, 0, max, TRUE); @@ -3237,17 +3231,6 @@ static LRESULT ME_WmCreate(ME_TextEditor *editor, LPARAM lParam, BOOL unicode) ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE); } } - - if (text) - { - ME_SetText(editor, text, unicode); - ME_SetCursorToStart(editor, &editor->pCursors[0]); - ME_SetCursorToStart(editor, &editor->pCursors[1]); - } - - ME_CommitUndo(editor); - ME_WrapMarkedParagraphs(editor); - update_caret(editor); return 0; }
@@ -3312,8 +3295,8 @@ static LRESULT handle_EM_SETCHARFORMAT( ME_TextEditor *editor, WPARAM flags, con * The LRESULT that is returned is a return value for window procs, * and the phresult parameter is the COM return code needed by the * text services interface. */ -LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, - LPARAM lParam, BOOL unicode, HRESULT* phresult) +LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, + LPARAM lParam, HRESULT* phresult ) { *phresult = S_OK;
@@ -3978,7 +3961,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, return (wParam >= 0x40000) ? 0 : MAKELONG( pt.x, pt.y ); } case WM_CREATE: - return ME_WmCreate(editor, lParam, unicode); + return ME_WmCreate( editor ); case WM_SETCURSOR: { POINT cursor_pos; @@ -4060,23 +4043,19 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, case WM_CHAR: return handle_wm_char( editor, wParam, lParam ); case WM_UNICHAR: - if (unicode) - { - if(wParam == UNICODE_NOCHAR) return TRUE; - if(wParam <= 0x000fffff) - { - if(wParam > 0xffff) /* convert to surrogates */ - { - wParam -= 0x10000; - 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; - } - break; + if (wParam == UNICODE_NOCHAR) return TRUE; + if (wParam <= 0x000fffff) + { + if (wParam > 0xffff) /* convert to surrogates */ + { + wParam -= 0x10000; + 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; case EM_STOPGROUPTYPING: ME_CommitUndo(editor); /* End coalesced undos for typed characters */ return 0; diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index ee2cde833c4..d0645356678 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -271,8 +271,8 @@ void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN; /* editor.c */ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN; void ME_DestroyEditor(ME_TextEditor *editor) DECLSPEC_HIDDEN; -LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, - LPARAM lParam, BOOL unicode, HRESULT* phresult) DECLSPEC_HIDDEN; +LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, + LPARAM lParam, HRESULT* phresult ) DECLSPEC_HIDDEN; void ME_SendOldNotify(ME_TextEditor *editor, int nCode) DECLSPEC_HIDDEN; int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen, const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index 0325d5d41d8..c80263bbd69 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -963,10 +963,27 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, }
case WM_CREATE: + { + CREATESTRUCTW *createW = (CREATESTRUCTW *)lparam; + CREATESTRUCTA *createA = (CREATESTRUCTA *)lparam; + void *text; + WCHAR *textW = NULL; + LONG codepage = unicode ? CP_UNICODE : CP_ACP; + int len; + ITextServices_OnTxPropertyBitsChange( host->text_srv, TXTBIT_CLIENTRECTCHANGE, 0 ); - res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr ); - break;
+ if (lparam) + { + text = unicode ? (void *)createW->lpszName : (void *)createA->lpszName; + textW = ME_ToUnicode( codepage, text, &len ); + } + ITextServices_TxSetText( host->text_srv, textW ); + if (lparam) ME_EndToUnicode( codepage, textW ); + + hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, lparam, &res ); + break; + } case WM_DESTROY: ITextHost_Release( &host->ITextHost_iface ); return 0; @@ -1254,7 +1271,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, break; } default: - res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr ); + hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, lparam, &res ); }
if (hr == S_FALSE) diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index 3f7688e6b25..9cf1908b4de 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -130,16 +130,16 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface) }
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage,20) -DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam, - LPARAM lparam, LRESULT *plresult) +DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage( ITextServices *iface, UINT msg, WPARAM wparam, + LPARAM lparam, LRESULT *result ) { - struct text_services *services = impl_from_ITextServices( iface ); - HRESULT hresult; - LRESULT lresult; + struct text_services *services = impl_from_ITextServices( iface ); + HRESULT hr; + LRESULT res;
- lresult = ME_HandleMessage( services->editor, msg, wparam, lparam, TRUE, &hresult ); - if (plresult) *plresult = lresult; - return hresult; + res = editor_handle_message( services->editor, msg, wparam, lparam, &hr ); + if (result) *result = res; + return hr; }
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw,52)