Module: wine Branch: master Commit: 26896f1bd519e6189f027b160849d16fb5992fa9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=26896f1bd519e6189f027b1608...
Author: Mark Harmstone hellas@burntcomma.com Date: Sat Feb 7 13:48:32 2015 +0000
comctl32: Fix clipping error with themed groupboxes.
---
dlls/comctl32/theme_button.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c index 01f16fb..78d7cc4 100644 --- a/dlls/comctl32/theme_button.c +++ b/dlls/comctl32/theme_button.c @@ -31,6 +31,10 @@ #include "vssym32.h" #include "comctl32.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(theme_button); + #define BUTTON_TYPE 0x0f /* bit mask for the available button types */
/* These are indices into a states array to determine the theme state for a given theme part. */ @@ -179,10 +183,23 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
RECT bgRect, textRect, contentRect; - HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0); - HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL; int state = states[ drawState ]; WCHAR *text = get_button_text(hwnd); + LOGFONTW lf; + HFONT font, hPrevFont = NULL; + BOOL created_font = FALSE; + + HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf); + if (SUCCEEDED(hr)) { + font = CreateFontIndirectW(&lf); + if (!font) + TRACE("Failed to create font\n"); + else { + hPrevFont = SelectObject(hDC, font); + created_font = TRUE; + } + } else + font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
GetClientRect(hwnd, &bgRect); textRect = bgRect; @@ -216,6 +233,7 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN HeapFree(GetProcessHeap(), 0, text); }
+ if (created_font) DeleteObject(font); if (hPrevFont) SelectObject(hDC, hPrevFont); }