LISTVIEW_SetItemState problem in FlashFXP (and other applications)

Dimitrie O. Paun dpaun at rogers.com
Sun Apr 10 21:40:12 CDT 2005


On Sun, Apr 10, 2005 at 09:06:37PM +0200, Rolf Kalbermatter wrote:
> Of course there are people here much more familiar with Common Controls
> than me, so I will probably not be able to do a quick fix to this myself. 

Good find! Can you test this patch?


Index: dlls/comctl32/listview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v
retrieving revision 1.406
diff -u -p -r1.406 listview.c
--- dlls/comctl32/listview.c	25 Mar 2005 20:49:00 -0000	1.406
+++ dlls/comctl32/listview.c	11 Apr 2005 02:37:26 -0000
@@ -2967,22 +2965,35 @@ static void LISTVIEW_AddGroupSelection(L
 {
     INT nFirst = min(infoPtr->nSelectionMark, nItem);
     INT nLast = max(infoPtr->nSelectionMark, nItem);
-    INT i;
+    NMLVODSTATECHANGE nmlv;
     LVITEMW item;
+    BOOL bOldChange;
+    INT i;
+
+    /* Temporarily disable change notification
+     * If the control is LVS_OWNERDATA, we need to send
+     * only one LVN_ODSTATECHANGED notification.
+     * See MSDN documentation for LVN_ITEMCHANGED.
+     */
+    bOldChange = infoPtr->bDoChangeNotify;
+    if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE;
 
     if (nFirst == -1) nFirst = nItem;
 
     item.state = LVIS_SELECTED;
     item.stateMask = LVIS_SELECTED;
 
-    /* FIXME: this is not correct LVS_OWNERDATA
-     * setting the item states individually will generate
-     * a LVN_ITEMCHANGED notification for each one. Instead,
-     * we have to send a LVN_ODSTATECHANGED notification.
-     * See MSDN documentation for LVN_ITEMCHANGED.
-     */
     for (i = nFirst; i <= nLast; i++)
 	LISTVIEW_SetItemState(infoPtr,i,&item);
+
+    ZeroMemory(&nmlv, sizeof(nmlv));
+    nmlv.iFrom = nFirst;
+    nmlv.iTo = nLast;
+    nmlv.uNewState = 0;
+    nmlv.uOldState = item.state;
+
+    notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv);
+    infoPtr->bDoChangeNotify = bOldChange;
 }
 
 

-- 
Dimi.



More information about the wine-devel mailing list