comctl32/button: Avoid drawing over content in themed group boxes.

Fix a regression from 7c9cacd, in which a ExcludeClipRect() call was removed by mistake.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52080
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-12-09 16:13:06 +08:00 committed by Alexandre Julliard
parent 743045b279
commit 66cb0ab34a
1 changed files with 17 additions and 6 deletions

View File

@ -2877,12 +2877,13 @@ cleanup:
static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
{
RECT clientRect, contentRect, imageRect, textRect, bgRect;
RECT clientRect, contentRect, labelRect, imageRect, textRect, bgRect;
HRGN region, textRegion = NULL;
LOGFONTW lf;
HFONT font, hPrevFont = NULL;
BOOL created_font = FALSE;
TEXTMETRICW textMetric;
LONG style;
int part;
HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
@ -2900,22 +2901,32 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
}
GetClientRect(infoPtr->hwnd, &clientRect);
contentRect = clientRect;
region = set_control_clipping(hDC, &clientRect);
bgRect = contentRect;
bgRect = clientRect;
GetTextMetricsW(hDC, &textMetric);
bgRect.top += (textMetric.tmHeight / 2) - 1;
InflateRect(&contentRect, -7, 1);
dtFlags = BUTTON_CalcLayoutRects(infoPtr, hDC, &contentRect, &imageRect, &textRect);
labelRect = clientRect;
InflateRect(&labelRect, -7, 1);
dtFlags = BUTTON_CalcLayoutRects(infoPtr, hDC, &labelRect, &imageRect, &textRect);
if (dtFlags != (UINT)-1 && !show_image_only(infoPtr))
{
textRegion = CreateRectRgnIndirect(&textRect);
ExtSelectClipRgn(hDC, textRegion, RGN_DIFF);
}
part = GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & BS_PUSHLIKE ? BP_PUSHBUTTON : BP_GROUPBOX;
style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
if (style & BS_PUSHLIKE)
{
part = BP_PUSHBUTTON;
}
else
{
part = BP_GROUPBOX;
GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &contentRect);
ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
}
if (IsThemeBackgroundPartiallyTransparent(theme, part, state))
DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);