Dmitry Timoshkov : user32: BUTTON_CalcLabelRect should use the button font.

Alexandre Julliard julliard at winehq.org
Tue Feb 7 16:02:29 CST 2017


Module: wine
Branch: master
Commit: e45b80088bc4bf6f048e267c09dc0ce83c1a3485
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e45b80088bc4bf6f048e267c09dc0ce83c1a3485

Author: Dmitry Timoshkov <dmitry at 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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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))




More information about the wine-cvs mailing list