richedit: Avoid calling ITextHost_TxNotify with EN_MSGFILTER.

Dylan Smith dylan.ah.smith at gmail.com
Thu Mar 5 16:06:47 CST 2009


The documentation for TxNotify says that it is not called with the
EN_MSGFILTER notification, so I made sure ME_FilterEvent didn't call
this method.

Previously TxNotify was being used, but wasn't implemented for windowed
richedit controls, because it wasn't supposed ot be called, thus I made
sure a FIXME message gets printed if this happens again.

This fixes the regression reported in Bug 17601.
---
 dlls/riched20/editor.c  |    5 ++++-
 dlls/riched20/txthost.c |    5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 09feb96..93d0c34 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2018,11 +2018,14 @@ ME_FilterEvent(ME_TextEditor *editor, UINT msg, WPARAM* wParam, LPARAM* lParam)
 {
     MSGFILTER msgf;
 
+    if (!editor->hWnd) return FALSE;
+    msgf.nmhdr.hwndFrom = editor->hWnd;
+    msgf.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID);
     msgf.nmhdr.code = EN_MSGFILTER;
     msgf.msg = msg;
     msgf.wParam = *wParam;
     msgf.lParam = *lParam;
-    if (ITextHost_TxNotify(editor->texthost, msgf.nmhdr.code, &msgf) == S_OK)
+    if (SendMessageW(GetParent(editor->hWnd), WM_NOTIFY, msgf.nmhdr.idFrom, (LPARAM)&msgf))
         return FALSE;
     *wParam = msgf.wParam;
     *lParam = msgf.lParam;
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 5032e87..8fabd83 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -452,8 +452,6 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface,
     HWND parent = GetParent(hwnd);
     UINT id = GetWindowLongW(hwnd, GWLP_ID);
 
-    /* Note: EN_MSGFILTER is documented as not being sent to TxNotify */
-
     switch (iNotify)
     {
         case EN_DROPFILES:
@@ -492,6 +490,9 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface,
             SendMessageW(parent, WM_COMMAND, MAKEWPARAM(id, iNotify), (LPARAM)hwnd);
             break;
 
+        case EN_MSGFILTER:
+            FIXME("EN_MSGFILTER is documented as not being sent to TxNotify\n");
+            /* fall through */
         default:
             return E_FAIL;
     }


More information about the wine-patches mailing list