riched20: Don't steal caret

Phil Krylov phil at newstar.rinet.ru
Thu Feb 2 16:12:25 CST 2006


ChangeLog:

Rich edit controls don't steal caret anymore.

---

 dlls/riched20/caret.c  |   10 +++++-----
 dlls/riched20/editor.c |    8 ++++++--
 dlls/riched20/editor.h |    1 -
 dlls/riched20/paint.c  |    1 -
 4 files changed, 11 insertions(+), 9 deletions(-)

8e15f4fb52d205d7ed4c1fb0fe6733d0788f9a24
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 7fd8b15..528e5c0 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -169,7 +169,7 @@ ME_GetCursorCoordinates(ME_TextEditor *e
 }
 
 
-void
+static void
 ME_MoveCaret(ME_TextEditor *editor)
 {
   int x, y, height;
@@ -182,6 +182,8 @@ ME_MoveCaret(ME_TextEditor *editor)
 
 void ME_ShowCaret(ME_TextEditor *ed)
 {
+  if (GetFocus() != ed->hWnd)
+    return;
   ME_MoveCaret(ed);
   ShowCaret(ed->hWnd);
 }
@@ -743,8 +745,7 @@ void ME_LButtonDown(ME_TextEditor *edito
   }
   ME_InvalidateSelection(editor);
   HideCaret(editor->hWnd);
-  ME_MoveCaret(editor);
-  ShowCaret(editor->hWnd);
+  ME_ShowCaret(editor);
   ME_ClearTempStyle(editor);
   ME_SendSelChange(editor);
 }
@@ -766,10 +767,9 @@ void ME_MouseMove(ME_TextEditor *editor,
   ME_InvalidateSelection(editor);
   editor->pCursors[0] = tmp_cursor;
   HideCaret(editor->hWnd);
-  ME_MoveCaret(editor);
   ME_InvalidateSelection(editor);
   ME_Repaint(editor);
-  ShowCaret(editor->hWnd);
+  ME_ShowCaret(editor);
   ME_SendSelChange(editor);
 }
 
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 621eefb..175c4a7 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -628,7 +628,7 @@ static LRESULT ME_StreamIn(ME_TextEditor
   if (!(format & SFF_SELECTION)) {
     ME_ClearTempStyle(editor);
   }
-  ME_MoveCaret(editor);
+  ME_ShowCaret(editor);
   ME_SendSelChange(editor);
   ME_SendRequestResize(editor, FALSE);
 
@@ -1848,7 +1848,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
   case WM_CREATE:
     ME_CommitUndo(editor);
     ME_WrapMarkedParagraphs(editor);
-    ME_MoveCaret(editor);
+    ME_ShowCaret(editor);
     return 0;
   case WM_DESTROY:
     ME_DestroyEditor(editor);
@@ -1994,8 +1994,10 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
       SetScrollPos(hWnd, SB_VERT, nPos, TRUE);
       if (editor->bRedraw)
       {
+        ME_HideCaret(editor);
         ScrollWindow(hWnd, 0, dy, NULL, NULL);
         UpdateWindow(hWnd);
+        ME_ShowCaret(editor);
       }
     }
     break;
@@ -2018,8 +2020,10 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
       SetScrollPos(hWnd, SB_VERT, nPos, TRUE);
       if (editor->bRedraw)
       {
+        ME_HideCaret(editor);
         ScrollWindow(hWnd, 0, dy, NULL, NULL);
         UpdateWindow(hWnd);
+        ME_ShowCaret(editor);
       }
     }
     break;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index f3d9b07..9560e81 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -146,7 +146,6 @@ void ME_SetSelection(ME_TextEditor *edit
 void ME_SelectWord(ME_TextEditor *editor);
 void ME_HideCaret(ME_TextEditor *ed);
 void ME_ShowCaret(ME_TextEditor *ed);
-void ME_MoveCaret(ME_TextEditor *ed);
 int ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol);
 int ME_CharFromPos(ME_TextEditor *editor, int x, int y);
 void ME_LButtonDown(ME_TextEditor *editor, int x, int y);
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index d35c539..6a87063 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -32,7 +32,6 @@ void ME_PaintContent(ME_TextEditor *edit
   yoffset = ME_GetYScrollPos(editor);
   ME_InitContext(&c, editor, hDC);
   SetBkMode(hDC, TRANSPARENT);
-  ME_MoveCaret(editor);
   item = editor->pBuffer->pFirst->next;
   c.pt.y -= yoffset;
   while(item != editor->pBuffer->pLast) {
-- 
1.0.GIT



More information about the wine-patches mailing list