Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57178
This makes [7-zip file manager](https://www.7-zip.org/) pressing enter while editing path work: * before: * [Icon near path becomes dark (7-zip file manager doesn't go to path).](https://old.reddit.com/r/winehq/comments/16ah3ze/7zip_cant_enter_path_from_p...) * after: * 7-zip file manager goes to path. * Path input displays incorrect path (shouldn't happen, bug in wine's comboboxex unrelated to toolbar).
-- v11: comctl32/toolbar: Forward WM_NOTIFY CBEN_ENDEDITW. comctl32/tests: Test WM_NOTIFY CBEN_ENDEDITW conversion and forwarding in toolbar.
From: Alanas alanas.00@mail.ru
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57178 --- dlls/comctl32/tests/toolbar.c | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 7c886e1f88f..7f680b27ec1 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -179,13 +179,47 @@ static BOOL equal_dc(HDC hdc1, HDC hdc2, int width, int height)
static void *alloced_str;
-static LRESULT parent_wnd_notify(LPARAM lParam) +static const NMCBEENDEDITW test_WM_NOTIFY_NMCBEENDEDITW = +{ + .hdr.hwndFrom = (HWND)0xabcd0001, + .hdr.idFrom = 0xabcd0002, + .hdr.code = CBEN_ENDEDITW, + .fChanged = 0xabcd0003, + .iNewSelection = 0xabcd0004, + .szText = {'L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',0}, + .iWhy = 0xabcd0005 +}; +static const NMCBEENDEDITA test_WM_NOTIFY_NMCBEENDEDITA = +{ + .hdr.hwndFrom = (HWND)0xabcd0001, + .hdr.idFrom = 0xabcd0002, + .hdr.code = CBEN_ENDEDITA, + .fChanged = 0xabcd0003, + .iNewSelection = 0xabcd0004, + .szText = {'L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',0}, + .iWhy = 0xabcd0005 +}; +static BOOL test_WM_NOTIFY_expect_CBEN_ENDEDITA; + +static LRESULT parent_wnd_notify(WPARAM wParam, LPARAM lParam) { NMHDR *hdr = (NMHDR *)lParam; NMTBHOTITEM *nmhi; NMTBDISPINFOA *nmdisp; switch (hdr->code) { + case CBEN_ENDEDITA: + if (test_WM_NOTIFY_expect_CBEN_ENDEDITA) + { + test_WM_NOTIFY_expect_CBEN_ENDEDITA = FALSE; + ok(!memcmp(hdr, &test_WM_NOTIFY_NMCBEENDEDITA, sizeof(NMCBEENDEDITA)), "Incorrectly converted NMCBEENDEDITW to NMCBEENDEDITA.\n"); + ok(wParam == 0xabcd0002, "Got unexpected wParam 0x%Ix.\n", wParam); + } + else + { + ok(FALSE, "Got unexpected WM_NOTIFY.\n"); + } + return 0xabcd0006; case TBN_HOTITEMCHANGE: nmhi = (NMTBHOTITEM *)lParam; g_fReceivedHotItemChange = TRUE; @@ -428,7 +462,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, switch (message) { case WM_NOTIFY: - return parent_wnd_notify(lParam); + return parent_wnd_notify(wParam, lParam); }
defwndproc_counter++; @@ -2833,6 +2867,20 @@ static void test_BTNS_SEP(void) DestroyWindow(hwnd); }
+static void test_WM_NOTIFY(void) +{ + HWND toolbar = NULL; + LRESULT ret; + + rebuild_toolbar(&toolbar); + test_WM_NOTIFY_expect_CBEN_ENDEDITA = TRUE; + ret = SendMessageA(toolbar, WM_NOTIFY, 0, (LPARAM)&test_WM_NOTIFY_NMCBEENDEDITW); + todo_wine ok(ret == 0xabcd0006, "SendMessageA returned 0x%Ix.\n", ret); + todo_wine ok(!test_WM_NOTIFY_expect_CBEN_ENDEDITA, "Toolbar didn't convert and forward WM_NOTIFY to parent.\n"); + test_WM_NOTIFY_expect_CBEN_ENDEDITA = FALSE; + DestroyWindow(toolbar); +} + START_TEST(toolbar) { ULONG_PTR ctx_cookie; @@ -2884,6 +2932,7 @@ START_TEST(toolbar) test_drawtext_flags(); test_imagelist(); test_BTNS_SEP(); + test_WM_NOTIFY();
if (!load_v6_module(&ctx_cookie, &ctx)) return;
From: Alanas alanas.00@mail.ru
This makes 7-Zip File Manager press enter in path input work.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57178 --- dlls/comctl32/tests/toolbar.c | 4 ++-- dlls/comctl32/toolbar.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 7f680b27ec1..b6edd6dd1eb 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -2875,8 +2875,8 @@ static void test_WM_NOTIFY(void) rebuild_toolbar(&toolbar); test_WM_NOTIFY_expect_CBEN_ENDEDITA = TRUE; ret = SendMessageA(toolbar, WM_NOTIFY, 0, (LPARAM)&test_WM_NOTIFY_NMCBEENDEDITW); - todo_wine ok(ret == 0xabcd0006, "SendMessageA returned 0x%Ix.\n", ret); - todo_wine ok(!test_WM_NOTIFY_expect_CBEN_ENDEDITA, "Toolbar didn't convert and forward WM_NOTIFY to parent.\n"); + ok(ret == 0xabcd0006, "SendMessageA returned 0x%Ix.\n", ret); + ok(!test_WM_NOTIFY_expect_CBEN_ENDEDITA, "Toolbar didn't convert and forward WM_NOTIFY to parent.\n"); test_WM_NOTIFY_expect_CBEN_ENDEDITA = FALSE; DestroyWindow(toolbar); } diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 690a02db6ee..9782ccd9298 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -6359,6 +6359,24 @@ TOOLBAR_Notify (TOOLBAR_INFO *infoPtr, LPNMHDR lpnmh) FIXME("TTN_GETDISPINFOA - should not be received; please report\n"); return 0;
+ /* FIXME: CBEN_ENDEDITW is just 1 of 4294967244 codes that should be forwarded */ + case CBEN_ENDEDITW: + if (!infoPtr->bUnicode) + { + NMCBEENDEDITW *nmedW = (NMCBEENDEDITW *)lpnmh; + NMCBEENDEDITA nmedA = {{0}}; + nmedA.hdr.code = CBEN_ENDEDITA; + nmedA.hdr.hwndFrom = nmedW->hdr.hwndFrom; + nmedA.hdr.idFrom = nmedW->hdr.idFrom; + nmedA.fChanged = nmedW->fChanged; + nmedA.iNewSelection = nmedW->iNewSelection; + nmedA.iWhy = nmedW->iWhy; + WideCharToMultiByte(CP_ACP, 0, nmedW->szText, ARRAY_SIZE(nmedW->szText), nmedA.szText, ARRAY_SIZE(nmedA.szText), + NULL, FALSE); + return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->idFrom, (LPARAM)&nmedA); + } + return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->idFrom, (LPARAM)lpnmh); + default: return 0; }
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=149729
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: win.c:4073: Test succeeded inside todo block: Expected active window 0000000002D4016A, got 0000000002D4016A. win.c:4074: Test succeeded inside todo block: Expected focus window 0000000002D4016A, got 0000000002D4016A.
On Mon Nov 18 15:04:10 2024 +0000, Alanas wrote:
changed this line in [version 11 of the diff](/wine/wine/-/merge_requests/6737/diffs?diff_id=143806&start_sha=44e833ab3e6efadcd63f5abf637478757abca028#80bec5fb0f9a667beeb7953ce870eb92dd1cfbdc_6373_6383)
Done inside this merge request.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/toolbar.c:
FIXME("TTN_GETDISPINFOA - should not be received; please report\n"); return 0;
- /* FIXME: CBEN_ENDEDITW is just 1 of 4294967244 codes that should be forwarded */
Let's add a FIXME() in the default case instead of putting a comment here.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/toolbar.c:
DestroyWindow(hwnd);
}
+static void test_WM_NOTIFY(void) +{
- HWND toolbar = NULL;
- LRESULT ret;
- rebuild_toolbar(&toolbar);
- test_WM_NOTIFY_expect_CBEN_ENDEDITA = TRUE;
- ret = SendMessageA(toolbar, WM_NOTIFY, 0, (LPARAM)&test_WM_NOTIFY_NMCBEENDEDITW);
Please add tests to verify that CBEN_ENDEDITW gets forwarded as well. You will need a Unicode parent window for that.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/toolbar.c:
static void *alloced_str;
-static LRESULT parent_wnd_notify(LPARAM lParam) +static const NMCBEENDEDITW test_WM_NOTIFY_NMCBEENDEDITW = +{
- .hdr.hwndFrom = (HWND)0xabcd0001,
- .hdr.idFrom = 0xabcd0002,
- .hdr.code = CBEN_ENDEDITW,
- .fChanged = 0xabcd0003,
- .iNewSelection = 0xabcd0004,
- .szText = {'L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',0},
- .iWhy = 0xabcd0005
+};
Add an empty line after this.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/toolbar.c:
- case CBEN_ENDEDITW:
if (!infoPtr->bUnicode)
{
NMCBEENDEDITW *nmedW = (NMCBEENDEDITW *)lpnmh;
NMCBEENDEDITA nmedA = {{0}};
nmedA.hdr.code = CBEN_ENDEDITA;
nmedA.hdr.hwndFrom = nmedW->hdr.hwndFrom;
nmedA.hdr.idFrom = nmedW->hdr.idFrom;
nmedA.fChanged = nmedW->fChanged;
nmedA.iNewSelection = nmedW->iNewSelection;
nmedA.iWhy = nmedW->iWhy;
WideCharToMultiByte(CP_ACP, 0, nmedW->szText, ARRAY_SIZE(nmedW->szText), nmedA.szText, ARRAY_SIZE(nmedA.szText),
NULL, FALSE);
return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->idFrom, (LPARAM)&nmedA);
}
return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->idFrom, (LPARAM)lpnmh);
I think reusing PAGER_Notify() is a good idea. You did it in your previous versions of MR. Let's rename PAGER_Notify() to COMCTL32_Notify() and move it to commctrl.c. PAGER_Notify() handles many notification codes, but we will only use it to handle CBEN_ENDEDITW here.
On Tue Nov 19 09:50:39 2024 +0000, Zhiyi Zhang wrote:
Let's add a FIXME() in the default case instead of putting a comment here.
`0024:fixme:toolbar:TOOLBAR_Notify `… spam in stderr because toolbar gets `NM_SETCURSOR` notification when mover cursor over 7-zip file manager's path input.
On Wed Nov 20 13:16:57 2024 +0000, Alanas wrote:
`0024:fixme:toolbar:TOOLBAR_Notify `… spam in stderr because toolbar gets `NM_SETCURSOR` notification when mover cursor over 7-zip file manager's path input.
Okay, we guess we can use WARN() instead.