comctl32/listview: Directly reset focused item on item count change.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-12-11 13:07:40 +03:00 committed by Alexandre Julliard
parent 8c68872416
commit 9f019b7c76
2 changed files with 2 additions and 2 deletions

View File

@ -8834,6 +8834,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
if (infoPtr->nFocusedItem >= nItems)
{
LISTVIEW_SetItemFocus(infoPtr, -1);
infoPtr->nFocusedItem = -1;
SetRectEmpty(&infoPtr->rcFocus);
}
}

View File

@ -6107,10 +6107,9 @@ todo_wine
ok(ret, "Failed to set item count.\n");
ret = SendMessageA(hwnd, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
todo_wine
ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", FALSE);
/* 2 items, focus on index 0, reduce to 1 item. */
flush_sequences(sequences, NUM_MSG_SEQUENCES);