comctl32/listview: Forward WM_ERASEBKGND to parent on CLR_NONE.

This commit is contained in:
Nikolay Sivov 2009-05-03 03:14:44 +04:00 committed by Alexandre Julliard
parent 1fac98d3c1
commit 50c3b530f7
2 changed files with 31 additions and 5 deletions

View File

@ -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;

View File

@ -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", 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);
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", FALSE);
res = ListView_SetBkColor(hwnd, CLR_DEFAULT);
expect(TRUE, res);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
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);