Fix button tests failures when theming is on.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/button.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index d3dcc67b169..7dfc1720508 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -2656,13 +2656,13 @@ cleanup: static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused) { RECT bgRect, textRect; - HFONT font = infoPtr->font; - HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL; NMCUSTOMDRAW nmcd; LRESULT cdrf; HWND parent; WCHAR *text;
+ if (infoPtr->font) SelectObject(hDC, infoPtr->font); + GetClientRect(infoPtr->hwnd, &bgRect); GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect); init_custom_draw(&nmcd, infoPtr, hDC, &bgRect); @@ -2672,7 +2672,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
/* Send erase notifications */ cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd); - if (cdrf & CDRF_SKIPDEFAULT) goto cleanup; + if (cdrf & CDRF_SKIPDEFAULT) return;
if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state)) DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL); @@ -2687,7 +2687,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in /* Send paint notifications */ nmcd.dwDrawStage = CDDS_PREPAINT; cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd); - if (cdrf & CDRF_SKIPDEFAULT) goto cleanup; + if (cdrf & CDRF_SKIPDEFAULT) return;
if (!(cdrf & CDRF_DOERASE) && (text = get_button_text(infoPtr))) { @@ -2700,7 +2700,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in nmcd.dwDrawStage = CDDS_POSTPAINT; SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd); } - if (cdrf & CDRF_SKIPPOSTPAINT) goto cleanup; + if (cdrf & CDRF_SKIPPOSTPAINT) return;
if (focused) { @@ -2716,9 +2716,6 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
DrawFocusRect( hDC, &focusRect ); } - -cleanup: - if (hPrevFont) SelectObject(hDC, hPrevFont); }
static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)