Angelo Haller : comctl32/listview: Send LVN_ODSTATECHANGED notification for LVS_OWNERDATA listview on selection changes.

Alexandre Julliard julliard at winehq.org
Mon Aug 8 15:19:03 CDT 2022


Module: wine
Branch: master
Commit: c73290154297e037d2f9181eba01759e1e13965f
URL:    https://gitlab.winehq.org/wine/wine/-/commit/c73290154297e037d2f9181eba01759e1e13965f

Author: Angelo Haller <angelo at szanni.org>
Date:   Tue Jun 28 16:16:10 2022 -0500

comctl32/listview: Send LVN_ODSTATECHANGED notification for LVS_OWNERDATA listview on selection changes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52534
Signed-off-by: Angelo Haller <angelo at szanni.org>

---

 dlls/comctl32/listview.c       | 16 ++++++++++++----
 dlls/comctl32/tests/listview.c |  4 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index bf22a90e987..e48b1fa2847 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -3610,6 +3610,7 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
  */
 static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
 {
+    INT nFirst = -1, nLast = -1;
     RANGES selection;
     DWORD old_mask;
     LVITEMW item;
@@ -3661,21 +3662,28 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
 	iterator_destroy(&i);
     }
 
-    /* disable per item notifications on LVS_OWNERDATA style
-       FIXME: single LVN_ODSTATECHANGED should be used */
+    /* Disable per item notifications on LVS_OWNERDATA style */
     old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
     if (infoPtr->dwStyle & LVS_OWNERDATA)
         infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
 
     LISTVIEW_DeselectAllSkipItems(infoPtr, selection);
 
-
     iterator_rangesitems(&i, selection);
     while(iterator_next(&i))
-	LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
+    {
+        /* Find the range for LVN_ODSTATECHANGED */
+        if (nFirst == -1)
+            nFirst = i.nItem;
+        nLast = i.nItem;
+        LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
+    }
     /* this will also destroy the selection */
     iterator_destroy(&i);
 
+    if (infoPtr->dwStyle & LVS_OWNERDATA)
+        LISTVIEW_SetOwnerDataState(infoPtr, nFirst, nLast, &item);
+
     infoPtr->notify_mask |= old_mask;
     LISTVIEW_SetItemFocus(infoPtr, nItem);
 }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index ed5222a5ee8..fec1a83de4d 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3577,7 +3577,7 @@ static void test_ownerdata_multiselect(void)
 
     ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
                 ownerdata_multiselect_odstatechanged_seq,
-                "ownerdata select multiple notification", TRUE);
+                "ownerdata select multiple notification", FALSE);
 
     res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0);
     expect(0, res);
@@ -3594,7 +3594,7 @@ static void test_ownerdata_multiselect(void)
 
     ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
                 ownerdata_multiselect_odstatechanged_seq,
-                "ownerdata select multiple notification", TRUE);
+                "ownerdata select multiple notification", FALSE);
 
     res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0);
     expect(0, res);




More information about the wine-cvs mailing list