Mikołaj Zalewski : comctl32: Scroll listview if changing scroll bounds changes the scroll pos.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 18 05:13:41 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: cb3424f642733ecdc5bdff93ab36d24558d9d4ad
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=cb3424f642733ecdc5bdff93ab36d24558d9d4ad

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Mon Apr 17 16:53:19 2006 +0200

comctl32: Scroll listview if changing scroll bounds changes the scroll pos.

---

 dlls/comctl32/listview.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 808dc93..4878778 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1634,6 +1634,7 @@ static void LISTVIEW_UpdateScroll(LISTVI
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     SCROLLINFO horzInfo, vertInfo;
+    INT dx, dy;
 
     if ((infoPtr->dwStyle & LVS_NOSCROLL) || !is_redrawing(infoPtr)) return;
 
@@ -1666,7 +1667,8 @@ static void LISTVIEW_UpdateScroll(LISTVI
   
     horzInfo.fMask = SIF_RANGE | SIF_PAGE;
     horzInfo.nMax = max(horzInfo.nMax - 1, 0);
-    SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE);
+    dx = GetScrollPos(infoPtr->hwndSelf, SB_HORZ);
+    dx -= SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE);
     TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo));
 
     /* Setting the horizontal scroll can change the listview size
@@ -1697,9 +1699,19 @@ static void LISTVIEW_UpdateScroll(LISTVI
 
     vertInfo.fMask = SIF_RANGE | SIF_PAGE;
     vertInfo.nMax = max(vertInfo.nMax - 1, 0);
-    SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE);
+    dy = GetScrollPos(infoPtr->hwndSelf, SB_VERT);
+    dy -= SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE);
     TRACE("vertInfo=%s\n", debugscrollinfo(&vertInfo));
 
+    /* Change of the range may have changed the scroll pos. If so move the content */
+    if (dx != 0 || dy != 0)
+    {
+        RECT listRect;
+        listRect = infoPtr->rcList;
+        ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &listRect, &listRect, 0, 0,
+            SW_ERASE | SW_INVALIDATE);
+    }
+
     /* Update the Header Control */
     if (uView == LVS_REPORT)
     {




More information about the wine-cvs mailing list