Commit in reactos/lib/comctl32 on MAIN
listview.c+341.5 -> 1.6
Sync with Wine-20040213:
Aric Stewart <aric@codeweavers.com>
Work toward properly updating the SelectionMark when the selected
state changed inside a listbox.

reactos/lib/comctl32
listview.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- listview.c	2 Jan 2004 19:49:45 -0000	1.5
+++ listview.c	17 Feb 2004 22:33:55 -0000	1.6
@@ -7043,6 +7043,40 @@
     else
 	bResult = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE);
 
+    /*
+     *update selection mark
+     *
+     * Investigation on windows 2k showed that selection mark was updated
+     * whenever a new selection was made, but if the selected item was
+     * unselected it was not updated.
+     *
+     * we are probably still not 100% accurate, but this at least sets the
+     * proper selection mark when it is needed
+     */
+
+    if (bResult && (lvItem.state & lvItem.stateMask & LVIS_SELECTED) &&
+        ((infoPtr->nSelectionMark == -1) || (lvItem.iItem <= infoPtr->nSelectionMark)))
+    {
+        int i;
+        infoPtr->nSelectionMark = -1;
+        for (i = 0; i < infoPtr->nItemCount; i++)
+        {
+            if (infoPtr->uCallbackMask & LVIS_SELECTED)
+            {
+                if (LISTVIEW_GetItemState(infoPtr, i, LVIS_SELECTED))
+                {
+                    infoPtr->nSelectionMark = i;
+                    break;
+                }
+            }
+            else if (ranges_contain(infoPtr->selectionRanges, i))
+            {
+                infoPtr->nSelectionMark = i;
+                break;
+            }
+        }
+    }
+
     return bResult;
 }
 
CVSspam 0.2.8