It seems to me that the Size routine of our treeview control has
an unnecessary traversal, so I put in some assertions to verify
it, and had no violations with the couple apps I have tested it
on.  

Does anyone know of the conditions under which this code is
necessary?  

thanks,
sue
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.81
diff -u -r1.81 treeview.c
--- dlls/comctl32/treeview.c    2000/10/17 00:29:18     1.81
+++ dlls/comctl32/treeview.c    2000/10/25 16:56:59
@@ -734,11 +734,12 @@
 }
 
 /* We know that only items after start need their order updated. */
-static void
+static BOOL 
 TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
 {
     TREEVIEW_ITEM *item;
     int order;
+    BOOL somethingChanged = FALSE;
 
     if (!start)
     {
@@ -751,6 +752,7 @@
     for (item = start; item != NULL;
          item = TREEVIEW_GetNextListItem(infoPtr, item))
     {
+        somethingChanged |= (item->visibleOrder != order);
        item->visibleOrder = order;
        order += item->iIntegral;
     }
@@ -762,6 +764,8 @@
     {
        TREEVIEW_ComputeItemRect(infoPtr, item);
     }
+
+    return somethingChanged;
 }
 
 
@@ -2578,7 +2582,7 @@
          wineItem != NULL;
          wineItem = TREEVIEW_GetNextListItem(infoPtr, wineItem))
     {
-       if (ISVISIBLE(wineItem))
+       assert(ISVISIBLE(wineItem));
        {
             /* Avoid unneeded calculations */
             if (wineItem->rect.top > rect.bottom)
@@ -4649,11 +4653,14 @@
 {
     if (wParam == SIZE_RESTORED)
     {
+       TREEVIEW_ITEM* prevFirstVis = infoPtr->firstVisible; 
        infoPtr->clientWidth  = SLOWORD(lParam);
        infoPtr->clientHeight = SHIWORD(lParam);
 
-       TREEVIEW_RecalculateVisibleOrder(infoPtr, NULL);
+       assert(TREEVIEW_RecalculateVisibleOrder(infoPtr, NULL) == FALSE);
        TREEVIEW_SetFirstVisible(infoPtr, infoPtr->firstVisible, TRUE);
+       assert(prevFirstVis == infoPtr->firstVisible);
+
        TREEVIEW_UpdateScrollBars(infoPtr);
     }
     else




Reply via email to