comctl32/button: Do not restore push button font after themed painting.
Fix button tests failures when theming is on. Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
760acf6c13
commit
8b30c00a7b
|
@ -2656,13 +2656,13 @@ cleanup:
|
||||||
static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
|
static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
|
||||||
{
|
{
|
||||||
RECT bgRect, textRect;
|
RECT bgRect, textRect;
|
||||||
HFONT font = infoPtr->font;
|
|
||||||
HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
|
|
||||||
NMCUSTOMDRAW nmcd;
|
NMCUSTOMDRAW nmcd;
|
||||||
LRESULT cdrf;
|
LRESULT cdrf;
|
||||||
HWND parent;
|
HWND parent;
|
||||||
WCHAR *text;
|
WCHAR *text;
|
||||||
|
|
||||||
|
if (infoPtr->font) SelectObject(hDC, infoPtr->font);
|
||||||
|
|
||||||
GetClientRect(infoPtr->hwnd, &bgRect);
|
GetClientRect(infoPtr->hwnd, &bgRect);
|
||||||
GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
|
GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
|
||||||
init_custom_draw(&nmcd, infoPtr, hDC, &bgRect);
|
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 */
|
/* Send erase notifications */
|
||||||
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
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))
|
if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
|
||||||
DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
|
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 */
|
/* Send paint notifications */
|
||||||
nmcd.dwDrawStage = CDDS_PREPAINT;
|
nmcd.dwDrawStage = CDDS_PREPAINT;
|
||||||
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
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)))
|
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;
|
nmcd.dwDrawStage = CDDS_POSTPAINT;
|
||||||
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
|
||||||
}
|
}
|
||||||
if (cdrf & CDRF_SKIPPOSTPAINT) goto cleanup;
|
if (cdrf & CDRF_SKIPPOSTPAINT) return;
|
||||||
|
|
||||||
if (focused)
|
if (focused)
|
||||||
{
|
{
|
||||||
|
@ -2716,9 +2716,6 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
|
||||||
|
|
||||||
DrawFocusRect( hDC, &focusRect );
|
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)
|
static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, int state, UINT dtFlags, BOOL focused)
|
||||||
|
|
Loading…
Reference in New Issue