comctl32/listview: Don't check for state changes we are not aware to store (with some tests).

This commit is contained in:
Nikolay Sivov 2009-05-13 02:09:18 +04:00 committed by Alexandre Julliard
parent afaa6d4635
commit a1cac2c314
2 changed files with 56 additions and 2 deletions

View File

@ -3508,7 +3508,8 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
item.iItem = lpLVItem->iItem;
item.iSubItem = lpLVItem->iSubItem;
item.mask = LVIF_STATE | LVIF_PARAM;
item.stateMask = ~0;
item.stateMask = (infoPtr->dwStyle & LVS_OWNERDATA) ? LVIS_FOCUSED | LVIS_SELECTED : ~0;
item.state = 0;
item.lParam = 0;
if (!isNew && !LISTVIEW_GetItemW(infoPtr, &item)) return FALSE;
@ -5553,7 +5554,8 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
dispInfo.item.state = 0;
/* apparently, we should not callback for lParam in LVS_OWNERDATA */
if ((lpLVItem->mask & ~(LVIF_STATE | LVIF_PARAM)) || infoPtr->uCallbackMask)
if ((lpLVItem->mask & ~(LVIF_STATE | LVIF_PARAM)) ||
((lpLVItem->mask & LVIF_STATE) && (infoPtr->uCallbackMask & lpLVItem->stateMask)))
{
UINT mask = lpLVItem->mask;

View File

@ -180,6 +180,11 @@ static const struct message textcallback_set_again_parent_seq[] = {
{ 0 }
};
static const struct message single_getdispinfo_parent_seq[] = {
{ WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
{ 0 }
};
struct subclass_info
{
WNDPROC oldproc;
@ -2045,6 +2050,53 @@ static void test_ownerdata(void)
ok_sequence(sequences, PARENT_SEQ_INDEX, ownderdata_select_focus_parent_seq,
"ownerdata focus notification", TRUE);
DestroyWindow(hwnd);
/* check notifications on LVM_GETITEM */
/* zero callback mask */
hwnd = create_listview_control(LVS_OWNERDATA);
ok(hwnd != NULL, "failed to create a listview window\n");
res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.stateMask = LVIS_SELECTED;
item.mask = LVIF_STATE;
res = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, res);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
"ownerdata getitem selected state 1", FALSE);
/* non zero callback mask but not we asking for */
res = SendMessageA(hwnd, LVM_SETCALLBACKMASK, LVIS_OVERLAYMASK, 0);
expect(TRUE, res);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.stateMask = LVIS_SELECTED;
item.mask = LVIF_STATE;
res = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, res);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
"ownerdata getitem selected state 2", FALSE);
/* LVIS_OVERLAYMASK callback mask, asking for index */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
memset(&item, 0, sizeof(item));
item.stateMask = LVIS_OVERLAYMASK;
item.mask = LVIF_STATE;
res = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, res);
ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq,
"ownerdata getitem selected state 2", FALSE);
DestroyWindow(hwnd);
}
static void test_norecompute(void)