Nikolay Sivov : comctl32/listview: Forward WM_ERASEBKGND to parent on CLR_NONE.

Alexandre Julliard julliard at winehq.org
Mon May 4 09:06:40 CDT 2009


Module: wine
Branch: master
Commit: 50c3b530f7e167cfe31579a5213ede6677bff110
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=50c3b530f7e167cfe31579a5213ede6677bff110

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sun May  3 03:14:44 2009 +0400

comctl32/listview: Forward WM_ERASEBKGND to parent on CLR_NONE.

---

 dlls/comctl32/listview.c       |    5 +++--
 dlls/comctl32/tests/listview.c |   31 ++++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 75556e6..0f163ef 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -36,8 +36,6 @@
  *   -- EN_KILLFOCUS should be handled in WM_COMMAND
  *   -- WM_CREATE: create the icon and small icon image lists at this point only if
  *      the LVS_SHAREIMAGELISTS style is not specified.
- *   -- WM_ERASEBKGND: forward this message to the parent window if the bkgnd
- *      color is CLR_NONE.
  *   -- WM_WINDOWPOSCHANGED: arrange the list items if the current view is icon
  *      or small icon and the LVS_AUTOARRANGE style is specified.
  *   -- WM_TIMER
@@ -8290,6 +8288,9 @@ static inline BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc)
 
     if (!GetClipBox(hdc, &rc)) return FALSE;
 
+    if (infoPtr->clrBk == CLR_NONE)
+        return SendMessageW(infoPtr->hwndNotify, WM_ERASEBKGND, (WPARAM)hdc, 0);
+
     /* for double buffered controls we need to do this during refresh */
     if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) return FALSE;
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 42bb189..b6cbd47 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1068,6 +1068,7 @@ static void test_redraw(void)
     HWND hwnd, hwndheader;
     HDC hdc;
     BOOL res;
+    DWORD r;
 
     hwnd = create_listview_control(0);
     hwndheader = subclass_header(hwnd);
@@ -1082,21 +1083,45 @@ static void test_redraw(void)
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* forward WM_ERASEBKGND to parent on CLR_NONE background color */
+    /* 1. Without backbuffer */
     res = ListView_SetBkColor(hwnd, CLR_NONE);
     expect(TRUE, res);
 
     hdc = GetWindowDC(hwndparent);
 
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
-    SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    r = SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    ok(r != 0, "Expected not zero result\n");
+    ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, forward_erasebkgnd_parent_seq,
+                "forward WM_ERASEBKGND on CLR_NONE", FALSE);
+
+    res = ListView_SetBkColor(hwnd, CLR_DEFAULT);
+    expect(TRUE, res);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    r = SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    ok(r != 0, "Expected not zero result\n");
+    ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, empty_seq,
+                "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
+
+    /* 2. With backbuffer */
+    SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_DOUBLEBUFFER,
+                                                     LVS_EX_DOUBLEBUFFER);
+    res = ListView_SetBkColor(hwnd, CLR_NONE);
+    expect(TRUE, res);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    r = SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    ok(r != 0, "Expected not zero result\n");
     ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, forward_erasebkgnd_parent_seq,
-                "forward WM_ERASEBKGND on CLR_NONE", TRUE);
+                "forward WM_ERASEBKGND on CLR_NONE", FALSE);
 
     res = ListView_SetBkColor(hwnd, CLR_DEFAULT);
     expect(TRUE, res);
 
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
-    SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    r = SendMessageA(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    todo_wine ok(r != 0, "Expected not zero result\n");
     ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, empty_seq,
                 "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
 




More information about the wine-cvs mailing list