Thomas Weidenmueller : comctl32: Fix painting bug in listview control.

Alexandre Julliard julliard at winehq.org
Tue Dec 11 11:37:23 CST 2007


Module: wine
Branch: master
Commit: 23dd46413c6e75eae10c57cf82eef7075dc79635
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=23dd46413c6e75eae10c57cf82eef7075dc79635

Author: Thomas Weidenmueller <thomas at reactsoft.com>
Date:   Mon Dec 10 23:43:43 2007 -0700

comctl32: Fix painting bug in listview control.

---

 dlls/comctl32/listview.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 5e4d4c0..8405d41 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -944,7 +944,7 @@ 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)
+static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd, BOOL SubItem)
 {
     if (lpnmlvcd->clrTextBk == CLR_DEFAULT)
         lpnmlvcd->clrTextBk = comctl32_color.clrWindow;
@@ -952,18 +952,21 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
         lpnmlvcd->clrText = comctl32_color.clrWindowText;
 
     /* apprently, for selected items, we have to override the returned values */
-    if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
+    if (!SubItem)
     {
-	if (infoPtr->bFocus)
-	{
-	    lpnmlvcd->clrTextBk = comctl32_color.clrHighlight;
-	    lpnmlvcd->clrText   = comctl32_color.clrHighlightText;
+        if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
+        {
+            if (infoPtr->bFocus)
+            {
+                lpnmlvcd->clrTextBk = comctl32_color.clrHighlight;
+                lpnmlvcd->clrText   = comctl32_color.clrHighlightText;
+            }
+            else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
+            {
+                lpnmlvcd->clrTextBk = comctl32_color.clr3dFace;
+                lpnmlvcd->clrText   = comctl32_color.clrBtnText;
+            }
         }
-	else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
-	{
-	    lpnmlvcd->clrTextBk = comctl32_color.clr3dFace;
-	    lpnmlvcd->clrText   = comctl32_color.clrBtnText;
-	}
     }
 
     /* Set the text attributes */
@@ -3787,7 +3790,9 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
         if (cdsubitemmode & CDRF_SKIPDEFAULT) goto postpaint;
     }
     if (nSubItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
-        prepaint_setup(infoPtr, hdc, &nmlvcd);
+        prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
+    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 && uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
@@ -3930,7 +3935,7 @@ static void LISTVIEW_RefreshOwnerDraw(const LISTVIEW_INFO *infoPtr, ITERATOR *i,
     
 	if (!(cditemmode & CDRF_SKIPDEFAULT))
 	{
-            prepaint_setup (infoPtr, hdc, &nmlvcd);
+            prepaint_setup (infoPtr, hdc, &nmlvcd, FALSE);
 	    SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
 	}
 
@@ -4118,7 +4123,7 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
     customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, 0);
     cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
     if (cdmode & CDRF_SKIPDEFAULT) goto enddraw;
-    prepaint_setup(infoPtr, hdc, &nmlvcd);
+    prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
 
     /* Use these colors to draw the items */
     infoPtr->clrTextBk = nmlvcd.clrTextBk;




More information about the wine-cvs mailing list