From: Zhiyi Zhang zzhang@codeweavers.com
If the listview header is a subclassed header that doesn't validate update regions when painting itself, for example, it paints without calling BeginPaint(), then after calling UpdateWindow() to paint the header, the update region for the header area is still there. Thus, the BeginPaint() call for the listview will end up sending a WM_ERASEBKGND to fill the header area, overwriting the content the subclassed header just painted. Tests show that header area should be validated even though the subclassed header doesn't do anything in its WM_PAINT handler.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47985 --- dlls/comctl32/listview.c | 10 +++++++++- dlls/comctl32/tests/listview.c | 1 - 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index a87a9ae37b2..fd2abfd1928 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -10828,7 +10828,15 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc) LISTVIEW_UpdateScroll(infoPtr); }
- if (infoPtr->hwndHeader) UpdateWindow(infoPtr->hwndHeader); + if (infoPtr->hwndHeader) + { + RECT rect; + + UpdateWindow(infoPtr->hwndHeader); + GetClientRect(infoPtr->hwndHeader, &rect); + MapWindowPoints(infoPtr->hwndHeader, infoPtr->hwndSelf, (POINT *)&rect, 2); + ValidateRect(infoPtr->hwndSelf, &rect); + }
if (hdc) LISTVIEW_Refresh(infoPtr, hdc, NULL); diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index eb5adced0a6..951def8fe0f 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -7751,7 +7751,6 @@ static LRESULT WINAPI listview_subclass_wmpaint_proc(HWND hwnd, UINT message, WP
header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0); GetClientRect(header, &header_client_rect); - todo_wine ok(!IntersectRect(&tmp_rect, &header_client_rect, &rect), "WM_ERASEBKGND dc clip box intersects with the header rectangle.\n"); }