riched20: Use CharFromPos instead of FindPixelPos in LinkNotify so it accounts for scrolling.

Matt Finnicum mattfinn at gmail.com
Tue Jan 23 14:44:29 CST 2007


ME_LinkNotify was calling FindPixelPos directly and thus not
accounting for the y position on the screen (from the mouse event) not
being the same as the absolute y position in the richedit control.
ME_CharFromPos takes care of this nicely. Fixes Bug 6873.

Changelog:
riched20: Use CharFromPos instead of FindPixelPos in LinkNotify so it
accounts for scrolling.

--Matt Finnicum

---
 dlls/riched20/editor.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 561574f..4c10414 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2574,14 +2574,17 @@ void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam
 {
   int x,y;
   ME_Cursor tmpCursor;
+  int nCharOfs; /* The start of the clicked text. Absolute character offset */
+
   ME_Run *tmpRun;
-  BOOL bNothing;
+
   ENLINK info;
   x = (short)LOWORD(lParam);
   y = (short)HIWORD(lParam);
-  ME_FindPixelPos(editor, x, y, &tmpCursor, &bNothing);
+  nCharOfs = ME_CharFromPos(editor, x, y);
+  ME_CursorFromCharOfs(editor, nCharOfs, &tmpCursor);
   tmpRun = &tmpCursor.pRun->member.run;
-	
+  
   if ((tmpRun->style->fmt.dwMask & CFM_LINK) 
     && (tmpRun->style->fmt.dwEffects & CFE_LINK))
   { /* The clicked run has CFE_LINK set */
-- 
1.4.4.4


More information about the wine-patches mailing list