From: Dmitry Timoshkov <dmitry(a)baikal.ru> Same calculation is used in the DefWindowProc() handler. This also fixes handling of region == 1: GetDCEx(hwnd, 1, DCX_INTERSECTRGN) won't work. Probably same fix is needed for other comctl32 themed controls. Spotted during testing of the CS_PARENTDC patches. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/comctl32/listview.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 13d1bd092f2..cedc44e5b6b 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -10706,14 +10706,22 @@ static LRESULT LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region) if (!theme || !(exstyle & WS_EX_CLIENTEDGE)) return DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)region, 0); - GetWindowRect(infoPtr->hwndSelf, &r); + GetClientRect(infoPtr->hwndSelf, &r); + cliprgn = CreateRectRgn(r.left, r.top, r.right, r.bottom); + if (region > (HRGN)1) + { + CombineRgn(cliprgn, region, cliprgn, RGN_DIFF); + dc = GetDCEx(infoPtr->hwndSelf, cliprgn, DCX_USESTYLE | DCX_WINDOW | DCX_INTERSECTRGN); + } + else + dc = GetDCEx(infoPtr->hwndSelf, cliprgn, DCX_USESTYLE | DCX_WINDOW | DCX_EXCLUDERGN); + GetWindowRect(infoPtr->hwndSelf, &r); cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge, r.right - cxEdge, r.bottom - cyEdge); if (region != (HRGN)1) CombineRgn (cliprgn, cliprgn, region, RGN_AND); - dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW | DCX_INTERSECTRGN); if (infoPtr->hwndHeader && LISTVIEW_IsHeaderEnabled(infoPtr)) { GetWindowRect(infoPtr->hwndHeader, &window_rect); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6617