user32/listbox: always call ScrollWindowEx in WM_VSCROLL handler

Daniel Jelinski djelinski1 at gmail.com
Wed Dec 12 13:45:45 CST 2012


-------------- next part --------------
From c5a2d17cf2c49c14984f779752bd912c3dc990f0 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Wed, 12 Dec 2012 20:34:31 +0100
Subject: user32/listbox: always call ScrollWindowEx in WM_VSCROLL handler

Fixes an issue in Delphi 7 property inspector, where scrolling by page
sometimes did not move child windows (property editors)
Other changes beside removing if(diff<height) are just formatting.
---
 dlls/user32/listbox.c |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 5686e24..b3709ef 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -297,20 +297,12 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll )
     if (index < 0) index = 0;
     if (descr->style & LBS_MULTICOLUMN) index -= index % descr->page_size;
     if (descr->top_item == index) return LB_OKAY;
-    if (descr->style & LBS_MULTICOLUMN)
-    {
-        INT diff = (descr->top_item - index) / descr->page_size * descr->column_width;
-        if (scroll && (abs(diff) < descr->width))
-            ScrollWindowEx( descr->self, diff, 0, NULL, NULL, 0, NULL,
-                              SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
-
-        else
-            scroll = FALSE;
-    }
-    else if (scroll)
+    if (scroll)
     {
         INT diff;
-        if (descr->style & LBS_OWNERDRAWVARIABLE)
+        if (descr->style & LBS_MULTICOLUMN)
+            diff = (descr->top_item - index) / descr->page_size * descr->column_width;
+        else if (descr->style & LBS_OWNERDRAWVARIABLE)
         {
             INT i;
             diff = 0;
@@ -328,11 +320,8 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll )
         else
             diff = (descr->top_item - index) * descr->item_height;
 
-        if (abs(diff) < descr->height)
-            ScrollWindowEx( descr->self, 0, diff, NULL, NULL, 0, NULL,
-                            SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
-        else
-            scroll = FALSE;
+        ScrollWindowEx( descr->self, 0, diff, NULL, NULL, 0, NULL,
+                        SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
     }
     if (!scroll) InvalidateRect( descr->self, NULL, TRUE );
     descr->top_item = index;
-- 
1.7.5.4


More information about the wine-patches mailing list