Akihiro Sagawa : comctl32: Prevent invalid focus change notifications from LVS_OWNERDATA lists.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 20 10:50:03 CST 2016
Module: wine
Branch: master
Commit: af4a757ad2cacbd238486632d0f7bd6f0a94483f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=af4a757ad2cacbd238486632d0f7bd6f0a94483f
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Wed Jan 20 22:34:42 2016 +0900
comctl32: Prevent invalid focus change notifications from LVS_OWNERDATA lists.
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/listview.c | 2 +-
dlls/comctl32/tests/listview.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 68a5515..419a823 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -8808,6 +8808,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
if (infoPtr->dwStyle & LVS_OWNERDATA)
{
INT nOldCount = infoPtr->nItemCount;
+ infoPtr->nItemCount = nItems;
if (nItems < nOldCount)
{
@@ -8820,7 +8821,6 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
}
}
- infoPtr->nItemCount = nItems;
LISTVIEW_UpdateScroll(infoPtr);
/* the flags are valid only in ownerdata report and list modes */
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 2afa44d..a6910d2 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3418,6 +3418,28 @@ static void test_ownerdata(void)
style = GetWindowLongPtrA(hwnd, GWL_STYLE);
ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n");
DestroyWindow(hwnd);
+
+ /* The focused item is updated after the invalidation */
+ hwnd = create_listview_control(LVS_OWNERDATA | LVS_REPORT);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 3, 0);
+ expect(TRUE, res);
+
+ memset(&item, 0, sizeof(item));
+ item.stateMask = LVIS_FOCUSED;
+ item.state = LVIS_FOCUSED;
+ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
+ expect(TRUE, res);
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 0, 0);
+ expect(TRUE, res);
+ ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
+ "ownerdata setitemcount", FALSE);
+
+ res = SendMessageA(hwnd, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
+ expect(-1, res);
+ DestroyWindow(hwnd);
}
static void test_norecompute(void)
More information about the wine-cvs
mailing list