Listview L8

Dimitrie O. Paun dpaun at rogers.com
Mon Oct 7 09:37:32 CDT 2002


ChangeLog
  Fix silly bug in SetItemPosition (we should set it, not create a new one).

--- dlls/comctl32/listview.c.L7	Mon Oct  7 02:07:37 2002
+++ dlls/comctl32/listview.c	Mon Oct  7 10:31:39 2002
@@ -6800,6 +6800,7 @@
 static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt)
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
+    POINT old;
 
     TRACE("(nItem=%d, &pt=%s\n", nItem, debugpoint(&pt));
 
@@ -6817,10 +6818,19 @@
 	pt.y -= ICON_TOP_PADDING;
     }
 
+    /* save the old position */
+    old.x = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
+    old.y = (LONG)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
+    
+    /* Is the position changing? */
+    if (pt.x == old.x && pt.y == old.y) return TRUE;
+   
+    /* FIXME: shouldn't we invalidate, as the item moved? */
+    
     /* Allocating a POINTER for every item is too resource intensive,
      * so we'll keep the (x,y) in different arrays */
-    if (DPA_InsertPtr(infoPtr->hdpaPosX, nItem, (void *)pt.x) == nItem &&
-        DPA_InsertPtr(infoPtr->hdpaPosY, nItem, (void *)pt.y) == nItem )
+    if (DPA_SetPtr(infoPtr->hdpaPosX, nItem, (void *)pt.x) &&
+        DPA_SetPtr(infoPtr->hdpaPosY, nItem, (void *)pt.y) )
 	return TRUE;
     
     ERR("We should never fail here (nItem=%d, pt=%s), please report.\n", 




More information about the wine-patches mailing list