comctl32: Skip scroll bars update if the treeview extents didn't change.

Dmitry Timoshkov dmitry at baikal.ru
Sun Feb 26 09:33:24 CST 2012


This patch should fix the regression reported in the bug 30004.
---
 dlls/comctl32/treeview.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 3f4fdc6..0adfc7e 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -2716,9 +2716,10 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
     BOOL horz = FALSE;
     SCROLLINFO si;
     LONG scrollX = infoPtr->scrollX;
+    LONG new_width, new_height;
 
-    infoPtr->treeWidth = 0;
-    infoPtr->treeHeight = 0;
+    new_width = 0;
+    new_height = 0;
 
     /* We iterate through all visible items in order to get the tree height
      * and width */
@@ -2729,11 +2730,11 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
 	if (ISVISIBLE(item))
 	{
             /* actually we draw text at textOffset + 2 */
-	    if (2+item->textOffset+item->textWidth > infoPtr->treeWidth)
-		infoPtr->treeWidth = item->textOffset+item->textWidth+2;
+	    if (2+item->textOffset+item->textWidth > new_width)
+		new_width = item->textOffset+item->textWidth+2;
 
 	    /* This is scroll-adjusted, but we fix this below. */
-	    infoPtr->treeHeight = item->rect.bottom;
+	    new_height = item->rect.bottom;
 	}
 
 	item = TREEVIEW_GetNextListItem(infoPtr, item);
@@ -2741,9 +2742,14 @@ TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
 
     /* Fix the scroll adjusted treeHeight and treeWidth. */
     if (infoPtr->root->firstChild)
-	infoPtr->treeHeight -= infoPtr->root->firstChild->rect.top;
+        new_height -= infoPtr->root->firstChild->rect.top;
+
+    new_width += infoPtr->scrollX;
+
+    if (infoPtr->treeWidth == new_width && infoPtr->treeHeight == new_height) return;
 
-    infoPtr->treeWidth += infoPtr->scrollX;
+    infoPtr->treeWidth = new_width;
+    infoPtr->treeHeight = new_height;
 
     if (infoPtr->dwStyle & TVS_NOSCROLL) return;
 
-- 
1.7.8.4




More information about the wine-patches mailing list