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; 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; COLORREF backcolor, textcolor;
backcolor = cd->clrTextBk;
textcolor = cd->clrText;
/* apparently, for selected items, we have to override the returned values */ /* apparently, for selected items, we have to override the returned values */
if (!SubItem) if (!SubItem)
{ {
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED) if (cd->nmcd.uItemState & CDIS_SELECTED)
{ {
if (infoPtr->bFocus) if (infoPtr->bFocus)
{ {
lpnmlvcd->clrTextBk = comctl32_color.clrHighlight; backcolor = comctl32_color.clrHighlight;
lpnmlvcd->clrText = comctl32_color.clrHighlightText; textcolor = comctl32_color.clrHighlightText;
} }
else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS) else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
{ {
lpnmlvcd->clrTextBk = comctl32_color.clr3dFace; backcolor = comctl32_color.clr3dFace;
lpnmlvcd->clrText = comctl32_color.clrBtnText; textcolor = comctl32_color.clrBtnText;
} }
} }
} }
backcolor = lpnmlvcd->clrTextBk;
textcolor = lpnmlvcd->clrText;
if (backcolor == CLR_DEFAULT) if (backcolor == CLR_DEFAULT)
backcolor = comctl32_color.clrWindow; backcolor = comctl32_color.clrWindow;
if (textcolor == CLR_DEFAULT) if (textcolor == CLR_DEFAULT)
@ -4812,11 +4812,6 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW) if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd); 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)) if (subitems->nItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE); 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; return CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM: case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
clr = GetBkColor(nmlvcd->nmcd.hdc); 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);
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) if (showsel_always && is_selected && nmlvcd->iSubItem)
ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr); ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
else 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); 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);
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;
} }
return CDRF_DODEFAULT; return CDRF_DODEFAULT;