Akihiro Sagawa : user32/listbox: Fix redraw after LB_SETCOUNT message.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 07:30:23 CST 2022


Module: wine
Branch: oldstable
Commit: 904ad1e120eb0e72f1af414848fbf365c43f68cd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=904ad1e120eb0e72f1af414848fbf365c43f68cd

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Thu Aug 12 21:17:42 2021 +0900

user32/listbox: Fix redraw after LB_SETCOUNT message.

3ef790b9680cbf38fc93b4902e3ca6c9f57c5422 accidentally dropped updating
LBS_DISPLAYCHANGED flag that had been done in LISTBOX_InvalidateItems()
if the count value was changed.
In fact, the newly added test shows LB_SETCOUNT message always causes
WM_DRAWITEM requests regardless of the count value.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51591
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 247185ba78a22bd0f84eeb753b59e377cebfd7a9)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/user32/listbox.c       | 2 ++
 dlls/user32/tests/listbox.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 0122f928ba8..912adb716d0 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1839,6 +1839,8 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, UINT count )
     if (!resize_storage(descr, count))
         return LB_ERRSPACE;
     descr->nb_items = count;
+    if (descr->style & LBS_NOREDRAW)
+        descr->style |= LBS_DISPLAYCHANGED;
 
     if (count)
     {
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 7d0ae5a2157..7817d623134 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -447,7 +447,6 @@ static void test_ownerdraw(void)
         got_drawitem = 0;
         ret = RedrawWindow(hLB, NULL, 0, RDW_UPDATENOW);
         ok(ret, "RedrawWindow failed\n");
-        todo_wine_if(testcase[i].message == LB_SETCOUNT)
         ok(got_drawitem == testcase[i].drawitem, "expected %u, got %u\n", testcase[i].drawitem, got_drawitem);
 
         DestroyWindow(hLB);




More information about the wine-cvs mailing list