wine/dlls/comctl32 listview.c

Dimitrie O. Paun dpaun at rogers.com
Thu May 8 08:07:49 CDT 2003


On May 6, 2003 01:51 pm, Rein Klazes wrote:
> This causes a regression in Newsbin. Normally when retrieving new
> headers they are displayed with a green background (showing that they
> are "new"). With the patch, I notice two things:
> - the first line is lacking the green the green background completely
> (so it is white);
> - following lines only the first column is painted correctly. The text
> in the other columns lacks the green background.

Rein,

Here is a completely untested patch (I didn't even have time to compile :),
but it should work. I think I found the problem for the first item (we
weren't setting CDDS_ITEM for item 0), and Maxime found (I think) the problem
for the second item (we weren't setting CDDS_SUBITEM for the columns).
What I don't understand about CDDS_SUBITEM is why is this a regression,
as we never set this CDDS_SUBITEM before...

Anyway, here it is, please let me know if it helps:

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v
retrieving revision 1.348
diff -u -r1.348 listview.c
--- dlls/comctl32/listview.c    2 May 2003 20:14:33 -0000       1.348
+++ dlls/comctl32/listview.c    8 May 2003 13:01:49 -0000
@@ -858,7 +858,7 @@
     lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
     lpnmlvcd->clrText   = infoPtr->clrText;
     if (!lplvItem) return;
-    lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem;
+    lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem + 1;
     lpnmlvcd->iSubItem = lplvItem->iSubItem;
     if (lplvItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED;
     if (lplvItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS;
@@ -868,9 +868,16 @@
  
 static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
 {
+    BOOL isForItem = (lpnmlvcd->nmcd.dwItemSpec != 0);
+    DWORD result;
+
     lpnmlvcd->nmcd.dwDrawStage = dwDrawStage;
-    if (lpnmlvcd->nmcd.dwItemSpec) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM;
-    return notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr);
+    if (isForItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM;
+    if (lpnmlvcd->iSubItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_SUBITEM;
+    if (isForItem) lpnmlvcd->nmcd.dwItemSpec--;
+    result = notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr);
+    if (isForItem) lpnmlvcd->nmcd.dwItemSpec++;
+    return result;
 }
  
 static DWORD notify_prepaint (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)


-- 
Dimi.




More information about the wine-devel mailing list