comctl32/listview: Send change notifications when inserting (LVIS_SELECTED|LVIS_FOCUSED) items.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f51b2ca8f7
commit
3cd366eee6
|
@ -4200,6 +4200,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
|
|||
LVITEMW item;
|
||||
/* stateMask is ignored for LVM_INSERTITEM */
|
||||
UINT stateMask = isNew ? ~0 : lpLVItem->stateMask;
|
||||
BOOL send_change_notification;
|
||||
|
||||
TRACE("()\n");
|
||||
|
||||
|
@ -4260,11 +4261,16 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
|
|||
nmlv.uChanged = uChanged ? uChanged : lpLVItem->mask;
|
||||
nmlv.lParam = item.lParam;
|
||||
|
||||
/* Send LVN_ITEMCHANGING notification, if the item is not being inserted
|
||||
/* Send change notification if the item is not being inserted, or inserted (selected|focused),
|
||||
and we are _NOT_ virtual (LVS_OWNERDATA), and change notifications
|
||||
are enabled. Even nothing really changed we still need to send this,
|
||||
are enabled. Even if nothing really changed we still need to send this,
|
||||
in this case uChanged mask is just set to passed item mask. */
|
||||
if (lpItem && !isNew && (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE))
|
||||
|
||||
send_change_notification = !isNew;
|
||||
send_change_notification |= (uChanged & LVIF_STATE) && (lpLVItem->state & (LVIS_FOCUSED | LVIS_SELECTED));
|
||||
send_change_notification &= !!(infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE);
|
||||
|
||||
if (lpItem && send_change_notification)
|
||||
{
|
||||
HWND hwndSelf = infoPtr->hwndSelf;
|
||||
|
||||
|
@ -4352,13 +4358,11 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
|
|||
}
|
||||
}
|
||||
|
||||
/* if we're inserting the item, we're done */
|
||||
if (isNew) return TRUE;
|
||||
|
||||
/* send LVN_ITEMCHANGED notification */
|
||||
if (send_change_notification)
|
||||
{
|
||||
if (lpLVItem->mask & LVIF_PARAM) nmlv.lParam = lpLVItem->lParam;
|
||||
if (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE)
|
||||
notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -6023,7 +6023,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, TRUE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused0_seq, buf, insert_item[i].mask != LVIF_STATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6060,7 +6060,7 @@ static void test_insertitem(void)
|
|||
item.iSubItem = 0;
|
||||
ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
|
||||
ok(ret == 0, "got %d\n", ret);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused0_seq, "insert focused 0", TRUE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused0_seq, "insert focused 0", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, LVM_GETITEMSTATE, 0, LVIS_FOCUSED);
|
||||
ok(state == LVIS_FOCUSED, "got %x\n", state);
|
||||
|
@ -6073,7 +6073,7 @@ static void test_insertitem(void)
|
|||
item.iSubItem = 0;
|
||||
ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
|
||||
ok(ret == 1, "got %d\n", ret);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused1_seq, "insert focused 1", TRUE);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused1_seq, "insert focused 1", FALSE);
|
||||
|
||||
state = SendMessageA(hwnd, LVM_GETITEMSTATE, 1, LVIS_FOCUSED);
|
||||
ok(state == LVIS_FOCUSED, "got %x\n", state);
|
||||
|
|
Loading…
Reference in New Issue