[PATCH 2/2] riched20: Only call InvalidateRect if the background color changes.
Alex Henrie
alexhenrie24 at gmail.com
Thu May 5 22:04:48 CDT 2016
Cc: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/riched20/editor.c | 4 ++++
dlls/riched20/tests/editor.c | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 85395e7..fa230de 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3617,11 +3617,15 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
if (wParam)
{
+ if (editor->rgbBackColor == -1)
+ return lColor;
editor->rgbBackColor = -1;
editor->hbrBackground = GetSysColorBrush(COLOR_WINDOW);
}
else
{
+ if (editor->rgbBackColor == lParam)
+ return lColor;
editor->rgbBackColor = lParam;
editor->hbrBackground = CreateSolidBrush(editor->rgbBackColor);
}
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 5c41116..5a038b5 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -8342,12 +8342,24 @@ static void test_background(void)
HWND hwndRichEdit = new_richedit(NULL);
RECT updateRect;
+ /* set the background color to the current, default background color (no-op) */
+ ValidateRect(hwndRichEdit, NULL);
+ SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, TRUE, 0);
+ GetUpdateRect(hwndRichEdit, &updateRect, FALSE);
+ ok(IsRectEmpty(&updateRect), "The update rect should be empty\n");
+
/* set the background color to black */
ValidateRect(hwndRichEdit, NULL);
SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, FALSE, 0);
GetUpdateRect(hwndRichEdit, &updateRect, FALSE);
ok(!IsRectEmpty(&updateRect), "The update rect should not be empty\n");
+ /* set the background color to the current, custom background color (no-op) */
+ ValidateRect(hwndRichEdit, NULL);
+ SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, FALSE, 0);
+ GetUpdateRect(hwndRichEdit, &updateRect, FALSE);
+ ok(IsRectEmpty(&updateRect), "The update rect should be empty\n");
+
DestroyWindow(hwndRichEdit);
}
--
2.8.2
More information about the wine-patches
mailing list