Merge branch 'master' into 'master'

comctl32/toolbar: forward unhandled WM_NOTIFY

See merge request wine/wine!6737
This commit is contained in:
Alanas 2024-11-19 22:26:55 +00:00
commit d9dbc7c2c1
2 changed files with 69 additions and 2 deletions

View file

@ -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);
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);
}
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;

View file

@ -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;
}