comctl32/listview: better handling of custom colors in report view

Daniel Jelinski djelinski1 at gmail.com
Sat Feb 9 17:07:02 CST 2013


-------------- next part --------------
From ab5c5d7ac659eb189d4f8e94377db4f452af2367 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 9 Feb 2013 23:52:51 +0100
Subject: [PATCH] comctl32/listview: better handling of custom colors in
 report view

Subitems' backgrounds in detail mode should also be painted.
See the application from bug 27854, tab "rainbow columns" for example.
Also fixes part of bug 27579 (black background of downloads).
Patch tested with all of the views, didn't break anything (or at least
I didn't notice).
---
 dlls/comctl32/listview.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index bc8997a..62a9e97 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4633,21 +4633,25 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     else if ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) == FALSE)
         prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
 
-    /* in full row select, subitems, will just use main item's colors */
-    if (nSubItem && infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
-	nmlvcd.clrTextBk = CLR_NONE;
-
     /* FIXME: temporary hack */
     rcSelect.left = rcLabel.left;
 
-    /* draw the selection background, if we're drawing the main item */
-    if (nSubItem == 0)
-    {
-        /* in icon mode, the label rect is really what we want to draw the
-         * background for */
-        if (infoPtr->uView == LV_VIEW_ICON)
-	    rcSelect = rcLabel;
+    /* in icon mode, the label rect is really what we want to draw the
+     * background for */
+    /* 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 ||
+        (infoPtr->uView == LV_VIEW_DETAILS &&
+        (!(lvItem.state & LVIS_SELECTED) ||
+        (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) != 0)))
+        rcSelect = rcLabel;
 
+    if (nmlvcd.clrTextBk != CLR_NONE)
+        ExtTextOutW(hdc, rcSelect.left, rcSelect.top, ETO_OPAQUE, &rcSelect, NULL, 0, NULL);
+
+    if(nSubItem == 0 && infoPtr->nFocusedItem == nItem)
+    {
 	if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
 	{
 	    /* we have to update left focus bound too if item isn't in leftmost column
@@ -4670,10 +4674,8 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
 	    rcSelect.right = rcBox.right;
 	}
 
-	if (nmlvcd.clrTextBk != CLR_NONE)
-	    ExtTextOutW(hdc, rcSelect.left, rcSelect.top, ETO_OPAQUE, &rcSelect, NULL, 0, NULL);
 	/* store new focus rectangle */
-	if (infoPtr->nFocusedItem == nItem) infoPtr->rcFocus = rcSelect;
+        infoPtr->rcFocus = rcSelect;
     }
 
     /* state icons */
-- 
1.7.5.4


More information about the wine-patches mailing list