[1/3] riched20: Implement handling of WM_KEYDOWN VK_RETURN in a dialog mode.

Dylan Smith dylan.ah.smith at gmail.com
Wed Sep 2 13:16:24 CDT 2009


On Wed, Sep 2, 2009 at 1:34 PM, Sergey Khodych<khodych at gmail.com> wrote:
>
>> 1. editor->hWnd may be NULL for windowless richedit controls, but you
>> code doesn't seem to take that into consideration.
>> 2. The style flags that you get from GetWindowLongW should probably
>> come from the cached values in editor->styleFlags.
>
> The main reason why GetWindowLongW is used there is that editor->styleFlags
> actually isn't window style and doesn't contain ES_WANTRETURN. What's the
> proper way to get actually window style in this case?
>

editor->styleFlags should cache any window styles that are needed on
window creation, but it seems ES_WANTRETURN was missed because it
wasn't used and there was not ITextHost property to associate it with.
 This can be handled where the extended styles are obtained as shown
in the following diff.  I tested and made sure the ES_WANTRETURN style
does get cached by native richedit by trying to change it with
SetWindowLong, so this is necessary.

diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index ddf3d76..d3a7330 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -58,6 +58,7 @@ ITextHost *ME_CreateTextHost(HWND hwnd, BOOL
bEmulateVersion10)
         texthost->bEmulateVersion10 = bEmulateVersion10;

         editor = ME_MakeEditor((ITextHost*)texthost, bEmulateVersion10);
+        editor->styleFlags |= GetWindowLongW(hwnd, GWL_STYLE) & ES_WANTRETURN;
         editor->exStyleFlags = GetWindowLongW(hwnd, GWL_EXSTYLE);
         editor->hWnd = hwnd; /* FIXME: Remove editor's dependence on hWnd */
         SetWindowLongPtrW(hwnd, 0, (LONG_PTR)editor);



More information about the wine-devel mailing list