When the listview expands or collapses an item it notifies the parent using the TVN_ITEMEXPANDING message. The parent can return true on this message and it prevents the treeview from expanding or collapsing the item. WINE does not let you deny TVN_ITEMEXPANDING by returning true.
From: Jacob Czekalla jczekalla@codeweavers.com
--- dlls/comctl32/tests/treeview.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index db4cc4fda71..86a25cf2a3e 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -52,6 +52,8 @@ static char *g_endedit_overwrite_ptr; static HFONT g_customdraw_font; static BOOL g_v6;
+static int tvn_itemexpanding_ret = 0; + #define NUM_MSG_SEQUENCES 3 #define TREEVIEW_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 1 @@ -1361,7 +1363,13 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, } case TVN_ITEMEXPANDINGA: { - UINT newmask = pTreeView->itemNew.mask & ~TVIF_CHILDREN; + UINT newmask; + if (tvn_itemexpanding_ret) + { + tvn_itemexpanding_ret = 0; + return TRUE; + } + newmask = pTreeView->itemNew.mask & ~TVIF_CHILDREN; ok(newmask == (TVIF_HANDLE | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_PARAM | TVIF_STATE), "got wrong mask %x\n", pTreeView->itemNew.mask); @@ -1837,6 +1845,8 @@ static void test_expandnotify(void) HWND hTree; BOOL ret; TVITEMA item; + HTREEITEM root; + RECT rc;
hTree = create_treeview_control(0); fill_tree(hTree); @@ -1898,6 +1908,25 @@ static void test_expandnotify(void)
DestroyWindow(hTree);
+ /* check that expansion can be denied by parent */ + hTree = create_treeview_control(0); + fill_tree(hTree); + + root = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, 0); + *((HTREEITEM*)&rc) = root; + + /* Simulate the double-click */ + tvn_itemexpanding_ret = 1; + SendMessageA(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc); + SendMessageA(hTree, WM_LBUTTONDBLCLK, MK_LBUTTON, MAKELPARAM(rc.left + ((rc.right - rc.left) / 2), rc.top + ((rc.bottom - rc.top) / 2))); + + /* check that it's expanded */ + item.state = TVIS_EXPANDED; + ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item); + todo_wine ok(!(item.state & TVIS_EXPANDED), "expected no expansion\n"); + + DestroyWindow(hTree); + /* test TVM_GETITEMRECT inside TVN_ITEMEXPANDED notification */ hTree = create_treeview_control(0); fill_tree(hTree);
From: Jacob Czekalla jczekalla@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53727 --- dlls/comctl32/tests/treeview.c | 2 +- dlls/comctl32/treeview.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index 86a25cf2a3e..38f019109b9 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -1923,7 +1923,7 @@ static void test_expandnotify(void) /* check that it's expanded */ item.state = TVIS_EXPANDED; ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item); - todo_wine ok(!(item.state & TVIS_EXPANDED), "expected no expansion\n"); + ok(!(item.state & TVIS_EXPANDED), "expected no expansion\n");
DestroyWindow(hTree);
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 036afd15c69..5f3dbfce71d 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3384,7 +3384,11 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, return FALSE;
if (bUser) - TREEVIEW_SendExpanding(infoPtr, item, action); + { + if(!TREEVIEW_SendExpanding(infoPtr, item, action)) + return TRUE; + } +
if (item->firstChild == NULL) return FALSE; @@ -3513,11 +3517,11 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, !(item->state & TVIS_EXPANDEDONCE)); if (sendsNotifications) { - if (!TREEVIEW_SendExpanding(infoPtr, item, TVE_EXPAND)) - { - TRACE(" TVN_ITEMEXPANDING returned TRUE, exiting...\n"); - return FALSE; - } + if (!TREEVIEW_SendExpanding(infoPtr, item, TVE_EXPAND)) + { + TRACE(" TVN_ITEMEXPANDING returned TRUE, exiting...\n"); + return TRUE; + } } if (!item->firstChild) return FALSE;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147569
Your paranoid android.
=== w8 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w864 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064v1507 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064v1809 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064_tsign (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w10pro64 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w11pro64 (32 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w864 (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064v1507 (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064v1809 (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064_2qxl (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064_adm (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w1064_tsign (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w10pro64 (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w10pro64_ar (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w10pro64_ja (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w10pro64_zh_CN (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== w11pro64_amd (64 bit report) ===
comctl32: treeview.c:1926: Test failed: expected no expansion
=== debian11b (64 bit WoW report) ===
dinput: hid.c:750: Test failed: WaitForSingleObject returned 0x102 hotplug.c:1052: Test failed: controller added handler not invoked
hid: device.c:123: Test failed: Failed to open L"\\?\hid#vid_1209&pid_0001#0&0000&0#{4d1e55b2-f16f-11cf-88cb-001111000030}", error 3. device.c:123: Test failed: Failed to open L"\\?\hid#vid_1209&pid_0001&col01#256&wine test&0&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}", error 3. device.c:123: Test failed: Failed to open L"\\?\hid#vid_1209&pid_0001&col02#256&wine test&0&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}", error 3. device.c:123: Test failed: Failed to open L"\\?\hid#vid_845e&pid_0001#0&0000&0&0&0#{4d1e55b2-f16f-11cf-88cb-001111000030}", error 3. device.c:123: Test failed: Failed to open L"\\?\hid#vid_845e&pid_0002#0&0000&0&0&0#{4d1e55b2-f16f-11cf-88cb-001111000030}", error 3. device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:319: Test failed: Failed to get product string(0x6) device.c:323: Test failed: Failed to get preparsed data(0x6) device.c:325: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:170: Test failed: got error 3 device.c:173: Test failed: Failed to get preparsed data(0x6) device.c:175: Test failed: Failed to get Caps(0xc0110001) device.c:405: Test failed: Failed to get product string(0x6) device.c:409: Test failed: Failed to get preparsed data(0x6) device.c:411: Test failed: Failed to get Caps(0xc0110001)
user32: input.c:2206: Test failed: got 0 messages input.c:2216: Test failed: got 0 messages input.c:1933: Test failed: expected non-zero input.c:1939: Test failed: expected -1, got 0 input.c:1940: Test failed: expected 122, got -559038737 input.c:1941: Test failed: expected non-zero input.c:1945: Test failed: expected non-zero input.c:2080: Test failed: expected non-zero