Module: wine Branch: stable Commit: e049888541b29c06b10992e8c6c3a8c24fc00d0d URL: https://source.winehq.org/git/wine.git/?a=commit;h=e049888541b29c06b10992e8c... Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Wed Jun 5 14:38:58 2019 +0300 user32/listbox: Fix mouse wheel scrolling for multi-column listboxes. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22253 Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit b95bc8427322d1fdcb79937aa16ef7e31f95f556) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/user32/listbox.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 594c956b94..e5b5059284 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -2025,7 +2025,7 @@ static LRESULT LISTBOX_HandleHScroll( LB_DESCR *descr, WORD scrollReq, WORD pos static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta ) { - UINT pulScrollLines = 3; + INT pulScrollLines = 3; SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); @@ -2039,9 +2039,20 @@ static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta ) if (descr->wheel_remain && pulScrollLines) { int cLineScroll; - pulScrollLines = min((UINT) descr->page_size, pulScrollLines); - cLineScroll = pulScrollLines * (float)descr->wheel_remain / WHEEL_DELTA; - descr->wheel_remain -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines; + if (descr->style & LBS_MULTICOLUMN) + { + pulScrollLines = min(descr->width / descr->column_width, pulScrollLines); + pulScrollLines = max(1, pulScrollLines); + cLineScroll = pulScrollLines * descr->wheel_remain / WHEEL_DELTA; + descr->wheel_remain -= WHEEL_DELTA * cLineScroll / pulScrollLines; + cLineScroll *= descr->page_size; + } + else + { + pulScrollLines = min(descr->page_size, pulScrollLines); + cLineScroll = pulScrollLines * descr->wheel_remain / WHEEL_DELTA; + descr->wheel_remain -= WHEEL_DELTA * cLineScroll / pulScrollLines; + } LISTBOX_SetTopItem( descr, descr->top_item - cLineScroll, TRUE ); } return 0;