From 12cc7a1721ed4142f57ca53e6a6c8d7042f8d3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Thu, 16 Aug 2018 18:03:49 +0300 Subject: [PATCH 2/2] user32/listbox: Fix scrolling for multi-column listboxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38565 Signed-off-by: Gabriel Ivăncescu --- dlls/user32/listbox.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 991ab87..3f1396d 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -300,28 +300,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 -- 1.9.1