comctl32: Prevent invalid focus change notifications from LVS_OWNERDATA lists.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3f2055b1cf
commit
af4a757ad2
|
@ -8808,6 +8808,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
|
||||||
if (infoPtr->dwStyle & LVS_OWNERDATA)
|
if (infoPtr->dwStyle & LVS_OWNERDATA)
|
||||||
{
|
{
|
||||||
INT nOldCount = infoPtr->nItemCount;
|
INT nOldCount = infoPtr->nItemCount;
|
||||||
|
infoPtr->nItemCount = nItems;
|
||||||
|
|
||||||
if (nItems < nOldCount)
|
if (nItems < nOldCount)
|
||||||
{
|
{
|
||||||
|
@ -8820,7 +8821,6 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->nItemCount = nItems;
|
|
||||||
LISTVIEW_UpdateScroll(infoPtr);
|
LISTVIEW_UpdateScroll(infoPtr);
|
||||||
|
|
||||||
/* the flags are valid only in ownerdata report and list modes */
|
/* the flags are valid only in ownerdata report and list modes */
|
||||||
|
|
|
@ -3418,6 +3418,28 @@ static void test_ownerdata(void)
|
||||||
style = GetWindowLongPtrA(hwnd, GWL_STYLE);
|
style = GetWindowLongPtrA(hwnd, GWL_STYLE);
|
||||||
ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n");
|
ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n");
|
||||||
DestroyWindow(hwnd);
|
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)
|
static void test_norecompute(void)
|
||||||
|
|
Loading…
Reference in New Issue