Zhiyi Zhang : comctl32/button: Use the brush from WM_CTLCOLORBTN to fill background for push buttons.
Alexandre Julliard
julliard at winehq.org
Wed Feb 9 16:03:49 CST 2022
Module: wine
Branch: master
Commit: 509d6a1d5f4ecfebb28dce33e7fc09540ae1403c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=509d6a1d5f4ecfebb28dce33e7fc09540ae1403c
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Wed Feb 9 16:45:01 2022 +0800
comctl32/button: Use the brush from WM_CTLCOLORBTN to fill background for push buttons.
The brush from WM_CTLCOLORBTN is used for filling background for push buttons after a DrawThemeParentBackground() call
according to tests.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/button.c | 7 +++++++
dlls/comctl32/tests/misc.c | 6 +++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 88b48a4a5c0..14b2200afed 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -2729,6 +2729,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
{
RECT bgRect, labelRect, imageRect, textRect, focusRect;
NMCUSTOMDRAW nmcd;
+ HBRUSH brush;
LRESULT cdrf;
HWND parent;
@@ -2748,7 +2749,13 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
if (cdrf & CDRF_SKIPDEFAULT) return;
if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
+ {
DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
+ /* Tests show that the brush from WM_CTLCOLORBTN is used for filling background after a
+ * DrawThemeParentBackground() call */
+ brush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
+ FillRect(hDC, &bgRect, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
+ }
DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
if (cdrf & CDRF_NOTIFYPOSTERASE)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
index 72674ea5942..09c5b3d6c40 100644
--- a/dlls/comctl32/tests/misc.c
+++ b/dlls/comctl32/tests/misc.c
@@ -841,15 +841,15 @@ static void test_themed_background(void)
tests[] =
{
{ANIMATE_CLASSA, 0, empty_seq, TRUE},
- {WC_BUTTONA, BS_PUSHBUTTON, pushbutton_seq, TRUE},
- {WC_BUTTONA, BS_DEFPUSHBUTTON, defpushbutton_seq, TRUE},
+ {WC_BUTTONA, BS_PUSHBUTTON, pushbutton_seq},
+ {WC_BUTTONA, BS_DEFPUSHBUTTON, defpushbutton_seq},
{WC_BUTTONA, BS_CHECKBOX, checkbox_seq, TRUE},
{WC_BUTTONA, BS_AUTOCHECKBOX, checkbox_seq, TRUE},
{WC_BUTTONA, BS_RADIOBUTTON, radiobutton_seq, TRUE},
{WC_BUTTONA, BS_3STATE, checkbox_seq, TRUE},
{WC_BUTTONA, BS_AUTO3STATE, checkbox_seq, TRUE},
{WC_BUTTONA, BS_GROUPBOX, groupbox_seq, TRUE},
- {WC_BUTTONA, BS_USERBUTTON, pushbutton_seq, TRUE},
+ {WC_BUTTONA, BS_USERBUTTON, pushbutton_seq},
{WC_BUTTONA, BS_AUTORADIOBUTTON, radiobutton_seq, TRUE},
{WC_BUTTONA, BS_PUSHBOX, radiobutton_seq, TRUE},
{WC_BUTTONA, BS_OWNERDRAW, ownerdrawbutton_seq},
More information about the wine-cvs
mailing list