[PATCH v4 2/7] comctl32/listview: Fix deselect on LVS_OWNERDATA.

Angelo Haller wine-devel at szanni.org
Tue Jun 28 16:16:07 CDT 2022


From: Angelo Haller <angelo at szanni.org>

Send one "deselect all items" notification on selection change for
LVS_OWNERDATA listviews instead of notifying about each individual
item change.

Enable LVS_OWNERDATA multi select tests for wine.

Signed-off-by: Angelo Haller <angelo at szanni.org>

---
v3: Remove double `;;` and clarify comment.
    Move patch to the front to enable tests in a more fine
    grained manner.
---
 dlls/comctl32/listview.c       | 6 ++++++
 dlls/comctl32/tests/listview.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 730bf4aaddd..6fc58c933a9 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -3405,6 +3405,12 @@ static BOOL LISTVIEW_DeselectAllSkipItems(LISTVIEW_INFO *infoPtr, RANGES toSkip)
 
     lvItem.state = 0;
     lvItem.stateMask = LVIS_SELECTED;
+
+    /* Only send one deselect all (-1) notification on LVS_OWNERDATA style */
+    if (infoPtr->dwStyle & LVS_OWNERDATA) {
+        LISTVIEW_SetItemState(infoPtr, -1, &lvItem);
+        return TRUE;
+    }
     
     /* need to clone the DPA because callbacks can change it */
     if (!(clone = ranges_clone(infoPtr->selectionRanges))) return FALSE;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index ec76984175f..7243a1858cd 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3692,7 +3692,7 @@ static void test_ownerdata_multiselect(void)
     expect(0, res);
     ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
                 ownerdata_multiselect_select_3_odstatechanged_seq,
-                "ownerdata multiselect: deselect all, select item 3 via DOWN", TRUE);
+                "ownerdata multiselect: deselect all, select item 3 via DOWN", FALSE);
     res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0);
     expect(0, res);
     res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
-- 
2.36.1




More information about the wine-devel mailing list