Dylan Smith : richedit: Invalidate without calling UpdateWindow in many cases.
Alexandre Julliard
julliard at winehq.org
Thu Jul 29 12:08:39 CDT 2010
Module: wine
Branch: master
Commit: dfa80b35b04692624378876a8fe0fe0fee3b7671
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dfa80b35b04692624378876a8fe0fe0fee3b7671
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Wed Jul 28 21:17:40 2010 -0400
richedit: Invalidate without calling UpdateWindow in many cases.
---
dlls/riched20/editor.c | 32 ++++++++++++++++----------------
dlls/riched20/editor.h | 2 +-
dlls/riched20/paint.c | 5 +++--
dlls/riched20/richole.c | 2 +-
dlls/riched20/txtsrv.c | 2 +-
dlls/riched20/undo.c | 4 ++--
6 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 959585a..0ed1959 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1583,7 +1583,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ME_ReleaseStyle(style);
editor->nEventMask = nEventMask;
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
if (!(format & SFF_SELECTION)) {
ME_ClearTempStyle(editor);
}
@@ -2137,7 +2137,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return TRUE;
ME_MoveCursorFromTableRowStartParagraph(editor);
ME_UpdateSelectionLinkAttribute(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
ME_SendRequestResize(editor, FALSE);
return TRUE;
case VK_RETURN:
@@ -2193,7 +2193,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[1] = editor->pCursors[0];
ME_CommitUndo(editor);
ME_CheckTablesForCorruption(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
else if (para == editor->pCursors[1].pPara &&
@@ -2218,7 +2218,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
ME_CommitCoalescingUndo(editor);
ME_CheckTablesForCorruption(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
} else { /* v1.0 - 3.0 */
@@ -2235,7 +2235,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_CommitCoalescingUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
} else {
@@ -2262,7 +2262,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
editor->pCursors[1] = editor->pCursors[0];
}
ME_CommitCoalescingUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
}
@@ -2280,7 +2280,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
SetCursor(NULL);
ME_UpdateSelectionLinkAttribute(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
}
return TRUE;
}
@@ -2319,7 +2319,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
{
ME_InternalDeleteText(editor, selStart, nChars, FALSE);
ME_CommitUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, TRUE);
}
return result;
}
@@ -2449,7 +2449,7 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
}
ME_UpdateSelectionLinkAttribute(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
}
return 0;
}
@@ -3299,7 +3299,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->nModifyStep = oldModify;
ME_EmptyUndoStack(editor);
}
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return len;
}
case EM_SETBKGNDCOLOR:
@@ -3460,7 +3460,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE);
ME_CommitUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, TRUE);
return 0;
}
case EM_REPLACESEL:
@@ -3488,7 +3488,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
ME_UpdateSelectionLinkAttribute(editor);
if (!wParam)
ME_EmptyUndoStack(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return len;
}
case EM_SCROLLCARET:
@@ -3566,7 +3566,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->nModifyStep = 0;
ME_CommitUndo(editor);
ME_EmptyUndoStack(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return 1;
}
case EM_CANPASTE:
@@ -3592,7 +3592,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
ME_InternalDeleteText(editor, selStart, nChars, FALSE);
ME_CommitUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, TRUE);
}
return 0;
}
@@ -4246,7 +4246,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]);
ME_DeleteSelection(editor);
ME_CommitUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return 0;
}
case WM_IME_COMPOSITION:
@@ -4278,7 +4278,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
ME_ReleaseStyle(style);
ME_CommitUndo(editor);
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return 0;
}
case WM_IME_ENDCOMPOSITION:
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 9739eea..10a1f2c 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -210,7 +210,7 @@ void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt);
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate);
void ME_Repaint(ME_TextEditor *editor);
void ME_RewrapRepaint(ME_TextEditor *editor);
-void ME_UpdateRepaint(ME_TextEditor *editor);
+void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now);
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor);
void ME_InvalidateSelection(ME_TextEditor *editor);
BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator);
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 0a32601..5e52e51 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -132,7 +132,7 @@ void ME_Repaint(ME_TextEditor *editor)
ITextHost_TxViewChange(editor->texthost, TRUE);
}
-void ME_UpdateRepaint(ME_TextEditor *editor)
+void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
{
/* Should be called whenever the contents of the control have changed */
BOOL wrappedParagraphs;
@@ -144,6 +144,8 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
/* Ensure that the cursor is visible */
ME_EnsureVisible(editor, &editor->pCursors[0]);
+ ITextHost_TxViewChange(editor->texthost, update_now);
+
ME_SendSelChange(editor);
/* send EN_CHANGE if the event mask asks for it */
@@ -153,7 +155,6 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
ME_SendOldNotify(editor, EN_CHANGE);
editor->nEventMask |= ENM_CHANGE;
}
- ME_Repaint(editor);
}
void
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 5b6b2b6..0f7db26 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -391,7 +391,7 @@ IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
ME_InsertOLEFromCursor(This->editor, reo, 0);
ME_CommitUndo(This->editor);
- ME_UpdateRepaint(This->editor);
+ ME_UpdateRepaint(This->editor, FALSE);
return S_OK;
}
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 7ab2af4..b4625ad 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -325,7 +325,7 @@ HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
This->editor->nModifyStep = 0;
OleFlushClipboard();
ME_EmptyUndoStack(This->editor);
- ME_UpdateRepaint(This->editor);
+ ME_UpdateRepaint(This->editor, FALSE);
return S_OK;
}
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index 8dab8fe..be7f0e1 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -402,7 +402,7 @@ BOOL ME_Undo(ME_TextEditor *editor) {
ME_CheckTablesForCorruption(editor);
editor->nUndoStackSize--;
editor->nUndoMode = nMode;
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
@@ -438,6 +438,6 @@ BOOL ME_Redo(ME_TextEditor *editor) {
ME_AddUndoItem(editor, diUndoEndTransaction, NULL);
ME_CheckTablesForCorruption(editor);
editor->nUndoMode = nMode;
- ME_UpdateRepaint(editor);
+ ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
More information about the wine-cvs
mailing list