[2/4] comctl32: do not send TVN_ITEMEXPANDING when expanding item with no children(try 2)
Daniel Jelinski
djelinski1 at gmail.com
Mon Oct 15 12:35:11 CDT 2012
-------------- next part --------------
From 7192ae6af6889df498354977e6173b7851d4da01 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Thu, 27 Sep 2012 21:06:48 +0200
Subject: comctl32: do not send TVN_ITEMEXPANDING when expanding item with no
children(try 2)
also, send it when re-expanding expanded item or re-collapsing collapsed one.
Tests in later commit (look for VK_ADD/VK_SUBSTRACT)
This allows for removing all items from a collapsed node by using TVE_COLLAPSERESET.
Fixes bug 30282, should also fix bugs: 23591, 22636, 8667
From the first try, removed sending TVN_EXPANDING notifications when handling TVM_EXPAND+TVE_COLLAPSE.
Added tests. This fixes hang in explorerframe tests.
---
dlls/comctl32/tests/treeview.c | 7 ++++++-
dlls/comctl32/treeview.c | 10 +++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index baf0e02..1021648 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1393,6 +1393,11 @@ static void test_expandnotify(void)
ret = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
expect(TRUE, ret);
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ ret = SendMessageA(hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)hRoot);
+ todo_wine expect(FALSE, ret);
+ ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "no collapse notifications", FALSE);
+
g_get_from_expand = TRUE;
/* expand */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@@ -1481,7 +1486,7 @@ static void test_expandnotify(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
ret = SendMessageA(hTree, WM_KEYDOWN, VK_ADD, 0);
expect(FALSE, ret);
- ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_empty_kb_seq, "expand node with no children", TRUE);
+ ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_empty_kb_seq, "expand node with no children", FALSE);
DestroyWindow(hTree);
}
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 032f49e..3f6b457 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3237,10 +3237,10 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
TRACE("TVE_COLLAPSE %p %s\n", item, TREEVIEW_ItemName(item));
- if (!(item->state & TVIS_EXPANDED))
+ if (!TREEVIEW_HasChildren(infoPtr, item))
return FALSE;
- if (bUser || !(item->state & TVIS_EXPANDEDONCE))
+ if (bUser)
TREEVIEW_SendExpanding(infoPtr, item, action);
if (item->firstChild == NULL)
@@ -3248,7 +3248,7 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
item->state &= ~TVIS_EXPANDED;
- if (bUser || !(item->state & TVIS_EXPANDEDONCE))
+ if (bUser)
TREEVIEW_SendExpanded(infoPtr, item, action);
bSetSelection = (infoPtr->selectedItem != NULL
@@ -3344,8 +3344,8 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
TRACE("(%p, %p, partial=%d, %d\n", infoPtr, item, partial, user);
- if (item->state & TVIS_EXPANDED)
- return TRUE;
+ if (!TREEVIEW_HasChildren(infoPtr, item))
+ return FALSE;
tmpItem = item; nextItem = NULL;
while (tmpItem)
--
1.7.5.4
More information about the wine-patches
mailing list