Commit b68e95ab authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Add a special case for deselect all attempt when nothing is selected.

parent 7773d6b0
......@@ -8857,6 +8857,10 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE
UINT oldstate = 0;
BOOL notify;
/* special case optimization for recurring attemp to deselect all */
if (lvItem.state == 0 && lvItem.stateMask == LVIS_SELECTED && !LISTVIEW_GetSelectedCount(infoPtr))
return TRUE;
/* select all isn't allowed in LVS_SINGLESEL */
if ((lvItem.state & lvItem.stateMask & LVIS_SELECTED) && (infoPtr->dwStyle & LVS_SINGLESEL))
return FALSE;
......
......@@ -2271,7 +2271,7 @@ static void test_multiselect(void)
item.state = 0;
item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "deselect all notification 2", TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "deselect all notification 2", FALSE);
/* any non-zero state value does the same */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
......@@ -3111,7 +3111,7 @@ static void test_ownerdata(void)
res = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
expect(TRUE, res);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", FALSE);
/* select one, then deselect all */
item.stateMask = LVIS_SELECTED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment