[PATCH v2 4/6] comctl32/listview: Send LVN_ODSTATECHANGED notification.

Angelo Haller wine-devel at szanni.org
Fri May 13 08:25:32 CDT 2022


From: Angelo Haller <angelo at szanni.org>

Send LVN_ODSTATECHANGED notification on selection change for
listviews when LVS_OWNERDATA is set.

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 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 318df0a4093..3c3f5af2a27 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -3597,6 +3597,8 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
  */
 static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
 {
+    INT nFirst = -1;
+    INT nLast = -1;
     RANGES selection;
     DWORD old_mask;
     LVITEMW item;
@@ -3648,21 +3650,25 @@ 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);
+    while(iterator_next(&i)) {
+        if (nFirst == -1)
+            nFirst = i.nItem;
+        nLast = i.nItem;
+        LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
+    }
     /* this will also destroy the selection */
     iterator_destroy(&i);
 
+    LISTVIEW_SetOwnerDataState(infoPtr, nFirst, nLast, &item);
+
     infoPtr->notify_mask |= old_mask;
     LISTVIEW_SetItemFocus(infoPtr, nItem);
 }
-- 
2.36.0




More information about the wine-devel mailing list