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

oldstable
Nikolay Sivov 2013-01-11 03:06:27 +04:00 committed by Alexandre Julliard
parent 7773d6b095
commit b68e95abd8
2 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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;