Commit 50c3b530 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Forward WM_ERASEBKGND to parent on CLR_NONE.

parent 1fac98d3
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
* -- EN_KILLFOCUS should be handled in WM_COMMAND * -- EN_KILLFOCUS should be handled in WM_COMMAND
* -- WM_CREATE: create the icon and small icon image lists at this point only if * -- WM_CREATE: create the icon and small icon image lists at this point only if
* the LVS_SHAREIMAGELISTS style is not specified. * 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 * -- WM_WINDOWPOSCHANGED: arrange the list items if the current view is icon
* or small icon and the LVS_AUTOARRANGE style is specified. * or small icon and the LVS_AUTOARRANGE style is specified.
* -- WM_TIMER * -- WM_TIMER
...@@ -8290,6 +8288,9 @@ static inline BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc) ...@@ -8290,6 +8288,9 @@ static inline BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc)
if (!GetClipBox(hdc, &rc)) return FALSE; 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 */ /* for double buffered controls we need to do this during refresh */
if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) return FALSE; if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) return FALSE;
......
...@@ -1068,6 +1068,7 @@ static void test_redraw(void) ...@@ -1068,6 +1068,7 @@ static void test_redraw(void)
HWND hwnd, hwndheader; HWND hwnd, hwndheader;
HDC hdc; HDC hdc;
BOOL res; BOOL res;
DWORD r;
hwnd = create_listview_control(0); hwnd = create_listview_control(0);
hwndheader = subclass_header(hwnd); hwndheader = subclass_header(hwnd);
...@@ -1082,21 +1083,45 @@ static void test_redraw(void) ...@@ -1082,21 +1083,45 @@ static void test_redraw(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* forward WM_ERASEBKGND to parent on CLR_NONE background color */ /* forward WM_ERASEBKGND to parent on CLR_NONE background color */
/* 1. Without backbuffer */
res = ListView_SetBkColor(hwnd, CLR_NONE); res = ListView_SetBkColor(hwnd, CLR_NONE);
expect(TRUE, res); expect(TRUE, res);
hdc = GetWindowDC(hwndparent); hdc = GetWindowDC(hwndparent);
flush_sequences(sequences, NUM_MSG_SEQUENCES); 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, 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); res = ListView_SetBkColor(hwnd, CLR_DEFAULT);
expect(TRUE, res); expect(TRUE, res);
flush_sequences(sequences, NUM_MSG_SEQUENCES); 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, ok_sequence(sequences, PARENT_FULL_SEQ_INDEX, empty_seq,
"don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE); "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment