Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/tests/combo.c | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 923d826b30..b4130139dd 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -46,6 +46,8 @@ static HWND hComboExParentWnd, hMainWnd; static HINSTANCE hMainHinst; static const char ComboExTestClass[] = "ComboExTestClass";
+static HBRUSH brush_red; + static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
#define MAX_CHARS 100 @@ -507,6 +509,8 @@ static BOOL init(void) wc.lpfnWndProc = ComboExTestWndProc; RegisterClassA(&wc);
+ brush_red = CreateSolidBrush(RGB(255, 0, 0)); + hMainWnd = CreateWindowA(WC_STATICA, "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0); ShowWindow(hMainWnd, SW_SHOW);
@@ -533,6 +537,7 @@ static void cleanup(void) UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL));
DestroyWindow(hMainWnd); + DeleteObject(brush_red); }
static void test_comboex_subclass(void) @@ -717,6 +722,7 @@ static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, L static LPCSTR expected_edit_text; static LPCSTR expected_list_text; static BOOL selchange_fired; +static HWND lparam_for_WM_CTLCOLOR = 0;
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -748,6 +754,19 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR break; } break; + case WM_CTLCOLOR: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + if (lparam_for_WM_CTLCOLOR) + { + ok(lparam_for_WM_CTLCOLOR == (HWND)lparam, "Expected %p, got %p\n", lparam_for_WM_CTLCOLOR, (HWND)lparam); + } + return (LRESULT) brush_red; }
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam); @@ -1254,6 +1273,60 @@ static void test_combo_dropdown_size(DWORD style) } }
+static void test_color_messages(void) +{ + HBRUSH brush; + int result; + COMBOBOXINFO info; + HWND handle_combo = create_combobox(CBS_DROPDOWN); + + old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc); + + info.cbSize = sizeof(COMBOBOXINFO); + SetLastError(0xdeadbeef); + result = GetComboBoxInfo(handle_combo, &info); + ok(result, "Failed to get combobox info structure.\n"); + + lparam_for_WM_CTLCOLOR = info.hwndItem; + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOR, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORMSGBOX, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOREDIT, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORLISTBOX, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORBTN, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORDLG, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSCROLLBAR, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + lparam_for_WM_CTLCOLOR = 0; + + DestroyWindow(handle_combo); + SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc); +} + START_TEST(combo) { ULONG_PTR ctx_cookie; @@ -1281,6 +1354,7 @@ START_TEST(combo) }
/* ComboBox control tests. */ + test_color_messages(); test_combo_WS_VSCROLL(); test_combo_setfont(CBS_DROPDOWN); test_combo_setfont(CBS_DROPDOWNLIST); -- 2.23.0
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/combo.c | 10 ++++++++++ dlls/comctl32/tests/combo.c | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/combo.c b/dlls/comctl32/combo.c index 8a52a0bdc0..6c7a22b8b4 100644 --- a/dlls/comctl32/combo.c +++ b/dlls/comctl32/combo.c @@ -2137,6 +2137,16 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam lphc->visibleItems = (INT)wParam; return TRUE;
+ case WM_CTLCOLOR: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return SendMessageW(lphc->owner, message, wParam, lParam); + default: if (message >= WM_USER) WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam ); diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index b4130139dd..2b2c7a45b9 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1290,35 +1290,27 @@ static void test_color_messages(void) lparam_for_WM_CTLCOLOR = info.hwndItem;
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOR, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORMSGBOX, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOREDIT, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORLISTBOX, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORBTN, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORDLG, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSCROLLBAR, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
lparam_for_WM_CTLCOLOR = 0; -- 2.23.0
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/tests/combo.c | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 0d3b1b170f..41edd746e1 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -33,6 +33,8 @@
static HWND hMainWnd;
+static HBRUSH brush_red; + #define expect_eq(expr, value, type, fmt); { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); } #define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \ r.bottom == _bottom && r.right == _right, "Invalid rect %s vs (%d,%d)-(%d,%d)\n", \ @@ -173,6 +175,7 @@ static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, L static LPCSTR expected_edit_text; static LPCSTR expected_list_text; static BOOL selchange_fired; +static HWND lparam_for_WM_CTLCOLOR = 0;
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -204,6 +207,19 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR break; } break; + case WM_CTLCOLOR: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + if (lparam_for_WM_CTLCOLOR) + { + ok(lparam_for_WM_CTLCOLOR == (HWND)lparam, "Expected %p, got %p\n", lparam_for_WM_CTLCOLOR, (HWND)lparam); + } + return (LRESULT) brush_red; }
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam); @@ -804,8 +820,62 @@ static void test_WS_VSCROLL(void) DestroyWindow(hCombo); }
+static void test_color_messages(void) +{ + HBRUSH brush; + int result; + COMBOBOXINFO info; + HWND handle_combo = build_combo(CBS_DROPDOWN); + + old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc); + + info.cbSize = sizeof(COMBOBOXINFO); + SetLastError(0xdeadbeef); + result = GetComboBoxInfo(handle_combo, &info); + ok(result, "Failed to get combobox info structure.\n"); + + lparam_for_WM_CTLCOLOR = info.hwndItem; + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOR, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORMSGBOX, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOREDIT, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORLISTBOX, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORBTN, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORDLG, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSCROLLBAR, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush); + + lparam_for_WM_CTLCOLOR = 0; + + DestroyWindow(handle_combo); + SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc); +} START_TEST(combo) { + brush_red = CreateSolidBrush(RGB(255, 0, 0)); hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0); ShowWindow(hMainWnd, SW_SHOW);
@@ -825,6 +895,8 @@ START_TEST(combo) test_listbox_styles(CBS_DROPDOWN); test_listbox_styles(CBS_DROPDOWNLIST); test_listbox_size(CBS_DROPDOWN); + test_color_messages();
DestroyWindow(hMainWnd); + DeleteObject(brush_red); } -- 2.23.0
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/combo.c | 9 +++++++++ dlls/user32/tests/combo.c | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 59c2e6484c..50f41e619e 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -2165,6 +2165,15 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar if( lphc->wState & CBF_EDIT ) return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam); return TRUE; + case WM_CTLCOLOR: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return SendMessageW(lphc->owner, message, wParam, lParam); default: if (message >= WM_USER) WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 41edd746e1..cea4351094 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -837,35 +837,27 @@ static void test_color_messages(void) lparam_for_WM_CTLCOLOR = info.hwndItem;
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOR, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORMSGBOX, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOREDIT, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORLISTBOX, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORBTN, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORDLG, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSCROLLBAR, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
lparam_for_WM_CTLCOLOR = 0; -- 2.23.0
I've sent an updated patchset with simplifications and including other messages. I'll send the message tests and static control tests after that, since they're only tangentially related.
Regards, Fabian Maurer
What should happen if parent/owner does not handle WM_CTLCOLOR* message?
What should happen if parent/owner does not handle WM_CTLCOLOR* message?
Then it should get passed to DefWindowProc. It's currently handled by DefWindowProc as well, but with these patches the parent is given a chance to handle it itself before it's passed to the default handler.
Regards, Fabian Maurer
On Sun, Sep 22, 2019 at 7:41 PM Fabian Maurer dark.shadow4@web.de wrote:
What should happen if parent/owner does not handle WM_CTLCOLOR* message?
Then it should get passed to DefWindowProc. It's currently handled by DefWindowProc as well, but with these patches the parent is given a chance to handle it itself before it's passed to the default handler.
I don't see this happening with your patch.
Regards, Fabian Maurer
Then it should get passed to DefWindowProc. It's currently handled by DefWindowProc as well, but with these patches the parent is given a chance to handle it itself before it's passed to the default handler.
I don't see this happening with your patch.
What exactly don't you see happening? DefWindowProc is where otherwise unhandled messages end up.
Regards, Fabian Maurer
On Mon, Sep 23, 2019 at 7:26 PM Fabian Maurer dark.shadow4@web.de wrote:
Then it should get passed to DefWindowProc. It's currently handled by DefWindowProc as well, but with these patches the parent is given a
chance
to handle it itself before it's passed to the default handler.
I don't see this happening with your patch.
What exactly don't you see happening? DefWindowProc is where otherwise unhandled messages end up.
As far as I can tell you return with SendMessage, so it's never passed to default procedure.
Regards, Fabian Maurer
As far as I can tell you return with SendMessage, so it's never passed to default procedure.
Yes, because combobox asks the parent to handle the message. If that doesn't want to handle it, it gets passed to the default procedure from there. No?
Regards, Fabian Maurer