Zhiyi Zhang : comctl32/button: Do not restore split button font after themed painting.
Alexandre Julliard
julliard at winehq.org
Fri Oct 1 18:02:22 CDT 2021
Module: wine
Branch: master
Commit: 84e0eac1f90b72e89fb4fcc7f9f35dbe1e5e56e8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=84e0eac1f90b72e89fb4fcc7f9f35dbe1e5e56e8
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Fri Oct 1 11:29:47 2021 +0800
comctl32/button: Do not restore split button font after themed painting.
Fix button test failures when theming is on.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/button.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index f0b2c56b5fe..1a5d2afa999 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -2876,12 +2876,13 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
static void SB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
{
- HFONT old_font = infoPtr->font ? SelectObject(hDC, infoPtr->font) : NULL;
RECT rc, content_rect, push_rect, dropdown_rect;
NMCUSTOMDRAW nmcd;
LRESULT cdrf;
HWND parent;
+ if (infoPtr->font) SelectObject(hDC, infoPtr->font);
+
GetClientRect(infoPtr->hwnd, &rc);
init_custom_draw(&nmcd, infoPtr, hDC, &rc);
@@ -2890,7 +2891,7 @@ static void SB_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);
@@ -2934,7 +2935,7 @@ static void SB_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))
{
@@ -2963,7 +2964,7 @@ static void SB_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)
{
@@ -2977,9 +2978,6 @@ static void SB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
push_rect.bottom -= margins.cyBottomHeight;
DrawFocusRect(hDC, &push_rect);
}
-
-cleanup:
- if (old_font) SelectObject(hDC, old_font);
}
static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
More information about the wine-cvs
mailing list