Module: wine Branch: master Commit: b68e95abd86a3db26f873d37f6317f3ad68763c6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b68e95abd86a3db26f873d37f6...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Jan 11 03:06:27 2013 +0400
comctl32/listview: Add a special case for deselect all attempt when nothing is selected.
---
dlls/comctl32/listview.c | 4 ++++ dlls/comctl32/tests/listview.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 79d55da..bb6d1b2 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -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; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 25321c3..cff6e92 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -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;