[PATCH v2 5/5] comctl32: LVM_INSERTITEM handler should send notifications with uChanged = LVIF_STATE.

Dmitry Timoshkov dmitry at baikal.ru
Fri Feb 11 06:36:59 CST 2022


According to the tests uChanged in the notification for a new item
has only LVIF_STATE flag set.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/comctl32/listview.c       | 8 +++++++-
 dlls/comctl32/tests/listview.c | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 137ca7c6529..e65d86f1ccc 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4257,7 +4257,13 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
         nmlv.uNewState = (item.state & ~stateMask) | (lpLVItem->state & stateMask);
         nmlv.uOldState = item.state;
     }
-    nmlv.uChanged = uChanged ? uChanged : lpLVItem->mask;
+    /* According to the tests uChanged in the notification for a new item
+     * has only LVIF_STATE flag set.
+     */
+    if (isNew)
+        nmlv.uChanged = LVIF_STATE;
+    else
+        nmlv.uChanged = uChanged ? uChanged : lpLVItem->mask;
     nmlv.lParam = item.lParam;
 
     /* Send LVN_ITEMCHANGING notification:
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 4521158d141..2dc77a78b75 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -6017,7 +6017,7 @@ static void test_LVM_INSERTITEM(void)
         if ((insert_item[i].mask & LVIF_STATE) && (insert_item[i].state & (LVIS_FOCUSED | LVIS_SELECTED)))
         {
             sprintf(buf, "%d: insert focused", i);
-            ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused0_seq, buf, insert_item[i].mask != LVIF_STATE);
+            ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused0_seq, buf, FALSE);
         }
         else
         {
@@ -6094,7 +6094,7 @@ static void test_insertitem(void)
     item.lParam = 0xdeadbeef;
     ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
     ok(ret == 3, "got %d\n", ret);
-    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_selected_seq, "insert selected", TRUE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_selected_seq, "insert selected", FALSE);
 
     /* insert item 4 */
     item.mask = LVIF_PARAM;
-- 
2.34.1




More information about the wine-devel mailing list