comctl32/listview: Always return zero state mask for subitems.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ce5fb75f7f
commit
6b2675dc8f
|
@ -6679,16 +6679,19 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
|
|||
/* make a local copy */
|
||||
isubitem = lpLVItem->iSubItem;
|
||||
|
||||
if (isubitem && (lpLVItem->mask & LVIF_STATE))
|
||||
lpLVItem->state = 0;
|
||||
|
||||
/* a quick optimization if all we're asked is the focus state
|
||||
* these queries are worth optimising since they are common,
|
||||
* and can be answered in constant time, without the heavy accesses */
|
||||
if ( (lpLVItem->mask == LVIF_STATE) && (lpLVItem->stateMask == LVIS_FOCUSED) &&
|
||||
!(infoPtr->uCallbackMask & LVIS_FOCUSED) )
|
||||
{
|
||||
lpLVItem->state = 0;
|
||||
if (infoPtr->nFocusedItem == lpLVItem->iItem)
|
||||
lpLVItem->state |= LVIS_FOCUSED;
|
||||
return TRUE;
|
||||
lpLVItem->state = 0;
|
||||
if (infoPtr->nFocusedItem == lpLVItem->iItem && isubitem == 0)
|
||||
lpLVItem->state |= LVIS_FOCUSED;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ZeroMemory(&dispInfo, sizeof(dispInfo));
|
||||
|
|
|
@ -6152,16 +6152,17 @@ static void test_state_image(void)
|
|||
insert_column(hwnd, 0);
|
||||
insert_column(hwnd, 1);
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = text;
|
||||
item.lParam = 123456;
|
||||
r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
|
||||
ok(r == 0, "Failed to insert an item.\n");
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED | LVIS_FOCUSED;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED | LVIS_FOCUSED;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
r = SendMessageA(hwnd, LVM_SETITEMA, 0, (LPARAM)&item);
|
||||
|
@ -6174,27 +6175,49 @@ static void test_state_image(void)
|
|||
r = SendMessageA(hwnd, LVM_SETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to set subitem text.\n");
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.mask = LVIF_STATE | LVIF_PARAM;
|
||||
item.stateMask = ~0u;
|
||||
item.state = 0;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
item.lParam = 0;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get item state.\n");
|
||||
ok(item.state == (INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED), "Unexpected item state %#x.\n", item.state);
|
||||
ok(item.state == (INDEXTOSTATEIMAGEMASK(1) | LVIS_SELECTED | LVIS_FOCUSED),
|
||||
"Unexpected item state %#x.\n", item.state);
|
||||
ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.mask = 0;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
todo_wine
|
||||
ok(item.state == INDEXTOSTATEIMAGEMASK(2), "Unexpected state %#x.\n", item.state);
|
||||
|
||||
item.mask = LVIF_STATE | LVIF_PARAM;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
item.lParam = 0;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
ok(item.state == 0, "Unexpected state %#x.\n", item.state);
|
||||
ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_FOCUSED;
|
||||
item.state = 0;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 1;
|
||||
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM)&item);
|
||||
ok(r, "Failed to get subitem state.\n");
|
||||
ok(item.state == 0, "Unexpected state %#x.\n", item.state);
|
||||
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = LVIS_STATEIMAGEMASK | LVIS_SELECTED;
|
||||
item.stateMask = ~0u;
|
||||
item.state = INDEXTOSTATEIMAGEMASK(2);
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 2;
|
||||
|
|
Loading…
Reference in New Issue