=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: comctl32/listbox: Fix scrolling for multi-column listboxes.

Alexandre Julliard julliard at winehq.org
Tue Aug 21 16:49:03 CDT 2018


Module: wine
Branch: master
Commit: 3f266610d5e8d720e245c06a4115980dd6f70e1a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3f266610d5e8d720e245c06a4115980dd6f70e1a

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Aug 16 18:03:49 2018 +0300

comctl32/listbox: Fix scrolling for multi-column listboxes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38565
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/listbox.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index b3491bb..5235ffd 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -275,28 +275,27 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll )
     if (descr->top_item == index) return LB_OKAY;
     if (scroll)
     {
-        INT diff;
+        INT dx = 0, dy = 0;
         if (descr->style & LBS_MULTICOLUMN)
-            diff = (descr->top_item - index) / descr->page_size * descr->column_width;
+            dx = (descr->top_item - index) / descr->page_size * descr->column_width;
         else if (descr->style & LBS_OWNERDRAWVARIABLE)
         {
             INT i;
-            diff = 0;
             if (index > descr->top_item)
             {
                 for (i = index - 1; i >= descr->top_item; i--)
-                    diff -= descr->items[i].height;
+                    dy -= descr->items[i].height;
             }
             else
             {
                 for (i = index; i < descr->top_item; i++)
-                    diff += descr->items[i].height;
+                    dy += descr->items[i].height;
             }
         }
         else
-            diff = (descr->top_item - index) * descr->item_height;
+            dy = (descr->top_item - index) * descr->item_height;
 
-        ScrollWindowEx( descr->self, 0, diff, NULL, NULL, 0, NULL,
+        ScrollWindowEx( descr->self, dx, dy, NULL, NULL, 0, NULL,
                         SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
     }
     else




More information about the wine-cvs mailing list