From: Tobiasz Laskowski <tlaskowski@codeweavers.com> The old code was not correct for multicolumn listboxes, so it caused the items to be displayed at an incorrect offset. LISTBOX_GetMaxTopIndex implements special cases for MULTICOLUMN and OWNERDRAWVARIABLE listboxes, allowing the top item to remain consistent. Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=59591 --- dlls/comctl32/tests/listbox.c | 1 - dlls/comctl32_v6/listbox.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 568ed727424..80f0f74a3f7 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -3033,7 +3033,6 @@ static void test_multicolumn_redraw(void) /* Ensure top_index is correct after redraw */ top_index_after = SendMessageA(listbox, LB_GETTOPINDEX, 0, 0); - todo_wine ok(top_index_after == top_index_before, "Expected top index %d after WM_SETREDRAW, got %d\n", top_index_before, top_index_after); diff --git a/dlls/comctl32_v6/listbox.c b/dlls/comctl32_v6/listbox.c index 7dec0e2d999..a46f7b03f16 100644 --- a/dlls/comctl32_v6/listbox.c +++ b/dlls/comctl32_v6/listbox.c @@ -730,8 +730,7 @@ static void LISTBOX_SetRedraw( LB_DESCR *descr, BOOL on ) InvalidateRect(descr->self, NULL, TRUE); if ((descr->top_item + descr->page_size) > descr->nb_items) { /* reset top of page if less than number of items/page */ - descr->top_item = descr->nb_items - descr->page_size; - if (descr->top_item < 0) descr->top_item = 0; + descr->top_item = LISTBOX_GetMaxTopIndex(descr); } descr->style &= ~LBS_DISPLAYCHANGED; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11491