Commit 0b6cf6e4 authored by Daniel Jelinski's avatar Daniel Jelinski Committed by Alexandre Julliard

comctl32: Fix notifications and return value when collapsing already collapsed node.

parent 9933f5e4
...@@ -1395,7 +1395,7 @@ static void test_expandnotify(void) ...@@ -1395,7 +1395,7 @@ static void test_expandnotify(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
ret = SendMessageA(hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)hRoot); ret = SendMessageA(hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)hRoot);
todo_wine expect(FALSE, ret); expect(FALSE, ret);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "no collapse notifications", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "no collapse notifications", FALSE);
g_get_from_expand = TRUE; g_get_from_expand = TRUE;
......
...@@ -3234,6 +3234,7 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -3234,6 +3234,7 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
RECT scrollRect; RECT scrollRect;
LONG scrollDist = 0; LONG scrollDist = 0;
TREEVIEW_ITEM *nextItem = NULL, *tmpItem; TREEVIEW_ITEM *nextItem = NULL, *tmpItem;
BOOL wasExpanded;
TRACE("TVE_COLLAPSE %p %s\n", item, TREEVIEW_ItemName(item)); TRACE("TVE_COLLAPSE %p %s\n", item, TREEVIEW_ItemName(item));
...@@ -3246,9 +3247,10 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -3246,9 +3247,10 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
if (item->firstChild == NULL) if (item->firstChild == NULL)
return FALSE; return FALSE;
wasExpanded = (item->state & TVIS_EXPANDED) != 0;
item->state &= ~TVIS_EXPANDED; item->state &= ~TVIS_EXPANDED;
if (bUser) if (wasExpanded && bUser)
TREEVIEW_SendExpanded(infoPtr, item, action); TREEVIEW_SendExpanded(infoPtr, item, action);
bSetSelection = (infoPtr->selectedItem != NULL bSetSelection = (infoPtr->selectedItem != NULL
...@@ -3329,7 +3331,7 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -3329,7 +3331,7 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
bSetFirstVisible ? item : infoPtr->firstVisible, bSetFirstVisible ? item : infoPtr->firstVisible,
TRUE); TRUE);
return TRUE; return wasExpanded;
} }
static BOOL static BOOL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment