changeset 1214:e16e7c51b6c7

Another attempt at fixing alternating row issues on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 09 Oct 2011 10:24:21 +0000
parents 22cedf18db25
children dc8ea09605f7
files win/dw.c
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sun Oct 09 10:13:16 2011 +0000
+++ b/win/dw.c	Sun Oct 09 10:24:21 2011 +0000
@@ -2711,19 +2711,15 @@
             GetUpdateRect(hWnd, &rectUpd, FALSE);
             /* allow default processing first */
             CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0);
-            /* set the row horizontal dimensions */
-            SetRect(&rect, rectUpd.left, 0, rectUpd.right, 0);
             /* number of displayed rows */
             iItems = ListView_GetCountPerPage(hWnd);
             /* first visible row */
             iTop = ListView_GetTopIndex(hWnd);
 
-            for(i=iTop; i<=iTop+iItems; i++) 
+            for(i=iTop; i<=(iTop+iItems+1); i++) 
             {
-                /* Get the row's rect */
-                ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS);
                 /* if row rectangle intersects update rectangle then it requires re-drawing */
-                if(IntersectRect(&rectDestin, &rectUpd, &rect)) 
+                if(ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, &rect)) 
                 {
                     /* change text background colour accordingly */
                     c = (i % 2) ? cinfo->odd : cinfo->even;
@@ -2732,7 +2728,7 @@
                     {
                         ListView_SetTextBkColor(hWnd, c);
                         /* invalidate the row rectangle then... */
-                        InvalidateRect(hWnd, &rect, FALSE);
+                        InvalidateRect(hWnd, &rectDestin, FALSE);
                         /* ...force default processing */
                         CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0);
                     }