[PATCH 2/3] user32: BUTTON_CalcLabelRect should use the button font.
Nikolay Sivov
nsivov at codeweavers.com
Sun Feb 5 11:52:47 CST 2017
From: Dmitry Timoshkov <dmitry at baikal.ru>
Otherwise WM_SETTEXT handler gets wrong rectangle to erase an old text.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/user32/button.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 4a03314201..eb5ec846e7 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -598,15 +598,22 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
switch (style & (BS_ICON|BS_BITMAP))
{
case BS_TEXT:
+ {
+ HFONT hFont, hPrevFont = 0;
+
if (!(text = get_button_text( hwnd ))) goto empty_rect;
if (!text[0])
{
HeapFree( GetProcessHeap(), 0, text );
goto empty_rect;
}
+
+ if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hdc, hFont );
DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
+ if (hPrevFont) SelectObject( hdc, hPrevFont );
HeapFree( GetProcessHeap(), 0, text );
break;
+ }
case BS_ICON:
if (!GetIconInfo((HICON)GetWindowLongPtrW( hwnd, HIMAGE_GWL_OFFSET ), &iconInfo))
--
2.11.0
More information about the wine-patches
mailing list