From: Huw Campbell <huw.campbell@gmail.com> --- dlls/comctl32/listview.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index b83bad11680..deb81939a65 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -2469,9 +2469,9 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW Icon.bottom += infoPtr->iconSize.cy; } } - else if (lpLVItem->iSubItem == 0 && infoPtr->uView == LV_VIEW_TILE) + else if (infoPtr->uView == LV_VIEW_TILE) { - Icon.left = Box.left + state_width; + Icon.left = Box.left; Icon.top = Box.top; Icon.right = Icon.left; Icon.bottom = Icon.top; @@ -4839,6 +4839,7 @@ static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const N HIMAGELIST himl; UINT format; RECT *focus; + BOOL isTileSubitem = infoPtr->uView == LV_VIEW_TILE && item->iSubItem; /* now check if we need to update the focus rectangle */ focus = infoPtr->bFocus && (item->state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0; @@ -4871,7 +4872,9 @@ static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const N /* in detail mode, we want to paint background for label rect when * item is not selected or listview has full row select; otherwise paint * background for text only */ - if ( infoPtr->uView == LV_VIEW_ICON || + /* finally, for tile subitems, we don't want to blat other labels in the + * select area, just this label's space. */ + if ( infoPtr->uView == LV_VIEW_ICON || isTileSubitem || (infoPtr->uView == LV_VIEW_DETAILS && (!(item->state & LVIS_SELECTED) || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)))) background = &rcLabel; @@ -4907,6 +4910,10 @@ static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const N } infoPtr->rcFocus = rcSelect; } + else if (isTileSubitem) + /* in tile mode the focus box wraps across all the labels; as the subitems are drawn after + * the main item, that means we can take a union here. */ + UnionRect(&infoPtr->rcFocus, &infoPtr->rcFocus, &rcLabel); else infoPtr->rcFocus = rcLabel; } @@ -4924,7 +4931,8 @@ static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const N /* item icons */ himl = ((infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_TILE) ? infoPtr->himlNormal : infoPtr->himlSmall); - if (himl && item->iImage >= 0 && !IsRectEmpty(&rcIcon)) + /* draw the icon if it exists and we're not the subitem in tile mode (the main item will draw it) */ + if (himl && item->iImage >= 0 && !IsRectEmpty(&rcIcon) && !isTileSubitem) { UINT style; @@ -4945,7 +4953,6 @@ static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const N if (infoPtr->hwndEdit && item->iItem == infoPtr->nEditLabelItem && item->iSubItem == 0) return; /* figure out the text drawing flags */ - /* now figure out the flags */ if (infoPtr->uView == LV_VIEW_ICON) format = focus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS; if (infoPtr->uView == LV_VIEW_TILE) @@ -5067,9 +5074,10 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT lvItem.lParam = 0; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; + szDispText[0] = 0; if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) - lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); + lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = callbackW; TRACE(" lvItem=%s\n", debuglvitem_t(&lvItem, TRUE)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10191