comctl32/listview: Do no alter custom draw text colors between notification stages.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-07-21 15:00:18 +03:00 committed by Alexandre Julliard
parent 536be09b84
commit c32720349c
2 changed files with 13 additions and 24 deletions

View File

@ -1055,31 +1055,31 @@ static inline DWORD notify_customdraw (const LISTVIEW_INFO *infoPtr, DWORD dwDra
return result;
}
static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd, BOOL SubItem)
static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, const NMLVCUSTOMDRAW *cd, BOOL SubItem)
{
COLORREF backcolor, textcolor;
backcolor = cd->clrTextBk;
textcolor = cd->clrText;
/* apparently, for selected items, we have to override the returned values */
if (!SubItem)
{
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
if (cd->nmcd.uItemState & CDIS_SELECTED)
{
if (infoPtr->bFocus)
{
lpnmlvcd->clrTextBk = comctl32_color.clrHighlight;
lpnmlvcd->clrText = comctl32_color.clrHighlightText;
backcolor = comctl32_color.clrHighlight;
textcolor = comctl32_color.clrHighlightText;
}
else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
{
lpnmlvcd->clrTextBk = comctl32_color.clr3dFace;
lpnmlvcd->clrText = comctl32_color.clrBtnText;
backcolor = comctl32_color.clr3dFace;
textcolor = comctl32_color.clrBtnText;
}
}
}
backcolor = lpnmlvcd->clrTextBk;
textcolor = lpnmlvcd->clrText;
if (backcolor == CLR_DEFAULT)
backcolor = comctl32_color.clrWindow;
if (textcolor == CLR_DEFAULT)
@ -4812,11 +4812,6 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
else
{
nmlvcd.clrTextBk = infoPtr->clrTextBk;
nmlvcd.clrText = infoPtr->clrText;
}
if (subitems->nItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);

View File

@ -1941,11 +1941,8 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
return CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
clr = GetBkColor(nmlvcd->nmcd.hdc);
todo_wine_if(showsel_always && is_selected && nmlvcd->iSubItem)
{
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background %#x.\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "Unexpected text color %#x.\n", nmlvcd->clrText);
}
if (showsel_always && is_selected && nmlvcd->iSubItem)
ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
else
@ -1962,11 +1959,8 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
ok(clr == c0ffee, "Unexpected background color %#x.\n", clr);
}
todo_wine_if(showsel_always)
{
ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background color %#x.\n", nmlvcd->clrTextBk);
ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
}
return CDRF_DODEFAULT;
}
return CDRF_DODEFAULT;