Module: wine Branch: stable Commit: c791260354ac499bd89587c2428c5455a9a8e76b URL: http://source.winehq.org/git/wine.git/?a=commit;h=c791260354ac499bd89587c242... Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Mon Feb 6 14:23:41 2017 +0300 user32: BUTTON_CalcLabelRect should use the button font. Otherwise WM_SETTEXT handler gets wrong rectangle to erase an old text. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit e45b80088bc4bf6f048e267c09dc0ce83c1a3485) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/user32/button.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/user32/button.c b/dlls/user32/button.c index e85e30d..cc70e37 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))