Zhiyi Zhang : comctl32/button: Avoid drawing over content in themed group boxes.
Alexandre Julliard
julliard at winehq.org
Thu Dec 9 15:34:27 CST 2021
Module: wine
Branch: master
Commit: 66cb0ab34acbca82423ccdeccb95895859b759fe
URL: https://source.winehq.org/git/wine.git/?a=commit;h=66cb0ab34acbca82423ccdeccb95895859b759fe
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Thu Dec 9 16:13:06 2021 +0800
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/button.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 9e0ed8a8987..063149e91a4 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -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);
More information about the wine-cvs
mailing list