richedit: Use ITextHost interface in ME_LinkNotify.

Dylan Smith dylan.ah.smith at gmail.com
Mon Sep 28 02:44:19 CDT 2009


Using the ITextHost interface allows this notification to be received for
windowless richedit controls.  Windowed richedit conrols have an ITextHost
implementation that will fill in hwndFrom and idFrom, but these should
probably be initialized to 0 for windowless richedit controls.
---
 dlls/riched20/caret.c  |    2 ++
 dlls/riched20/editor.c |    6 +++---
 dlls/riched20/wrap.c   |    2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index fdcb924..500b6c7 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -1537,6 +1537,8 @@ void ME_SendSelChange(ME_TextEditor *editor)
   if (!(editor->nEventMask & ENM_SELCHANGE))
     return;
 
+  sc.nmhdr.hwndFrom = NULL;
+  sc.nmhdr.idFrom = 0;
   sc.nmhdr.code = EN_SELCHANGE;
   ME_GetSelectionOfs(editor, &sc.chrg.cpMin, &sc.chrg.cpMax);
   sc.seltyp = SEL_EMPTY;
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 09e3de6..97e55ba 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2941,8 +2941,8 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
   if (cursor.pRun->member.run.style->fmt.dwMask & CFM_LINK &&
       cursor.pRun->member.run.style->fmt.dwEffects & CFE_LINK)
   { /* The clicked run has CFE_LINK set */
-    info.nmhdr.hwndFrom = editor->hWnd;
-    info.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID);
+    info.nmhdr.hwndFrom = NULL;
+    info.nmhdr.idFrom = 0;
     info.nmhdr.code = EN_LINK;
     info.msg = msg;
     info.wParam = wParam;
@@ -2950,7 +2950,7 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
     cursor.nOffset = 0;
     info.chrg.cpMin = ME_GetCursorOfs(&cursor);
     info.chrg.cpMax = info.chrg.cpMin + cursor.pRun->member.run.strText->nLen;
-    SendMessageW(GetParent(editor->hWnd), WM_NOTIFY,info.nmhdr.idFrom, (LPARAM)&info);
+    ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
   }
 }
 
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 579f33a..00229b2 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -776,6 +776,8 @@ ME_SendRequestResize(ME_TextEditor *editor, BOOL force)
     {
       REQRESIZE info;
 
+      info.nmhdr.hwndFrom = NULL;
+      info.nmhdr.idFrom = 0;
       info.nmhdr.code = EN_REQUESTRESIZE;
       info.rc = rc;
       info.rc.right = editor->nTotalWidth;


More information about the wine-patches mailing list