Zhiyi Zhang : comctl32/button: Pass the destination rectangle to GetThemePartSize() when painting check boxes.

Alexandre Julliard julliard at winehq.org
Fri Jul 15 14:44:41 CDT 2022


Module: wine
Branch: master
Commit: 830348d78c38e9f68772bd6e5a3ea2555a206dd8
URL:    https://gitlab.winehq.org/wine/wine/-/commit/830348d78c38e9f68772bd6e5a3ea2555a206dd8

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Fri Jul 15 14:57:59 2022 +0800

comctl32/button: Pass the destination rectangle to GetThemePartSize() when painting check boxes.

The destination rectangle may be smaller than that of theme parts, in which case, the draw size
returned is adjusted to fit the destination rectangle. Without passing a destination rectangle
to GetThemePartSize(), the function assumes that there is no limit for destination.

This fixes winecfg check boxes missing the upper edge in 192 DPI. You may notice that the check box
bitmap is slightly shrank and so the shape is a bit off. However, this is what happens on Windows as
well when check box height is set to 8 DLUs.

GetThemePartSize() without destination rectangles are also used in other controls, but manual tests
showed that those controls don't shrink their theme background as check boxes do so they are left
unchanged.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>

---

 dlls/comctl32/button.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index ee7c2c288b1..089534b2b9d 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -2830,7 +2830,7 @@ static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
     GetThemeBackgroundContentRect(theme, hDC, part, state, &client_rect, &content_rect);
     region = set_control_clipping(hDC, &client_rect);
 
-    if (FAILED(GetThemePartSize(theme, hDC, part, state, NULL, TS_DRAW, &box_size)))
+    if (FAILED(GetThemePartSize(theme, hDC, part, state, &content_rect, TS_DRAW, &box_size)))
     {
         box_size.cx = 12 * GetDpiForWindow(infoPtr->hwnd) / 96 + 1;
         box_size.cy = box_size.cx;




More information about the wine-cvs mailing list