Huw Davies : user32: The offset between the button and the text is half the digit width.

Alexandre Julliard julliard at winehq.org
Mon Aug 22 10:24:13 CDT 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Aug 22 08:58:30 2016 +0100

user32: The offset between the button and the text is half the digit width.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/button.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 5ed9c92..b8a1cee 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -851,7 +851,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
 {
     RECT rbox, rtext, client;
     HBRUSH hBrush;
-    int delta;
+    int delta, text_offset;
     UINT dtFlags;
     HFONT hFont;
     LONG state = get_button_state( hwnd );
@@ -869,6 +869,8 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
     rbox = rtext = client;
 
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
+    GetCharWidthW( hDC, '0', '0', &text_offset );
+    text_offset /= 2;
 
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
@@ -881,14 +883,12 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
 
     if (style & BS_LEFTTEXT)
     {
-	/* magic +4 is what CTL3D expects */
-
-        rtext.right -= checkBoxWidth + 4;
+        rtext.right -= checkBoxWidth + text_offset;
         rbox.left = rbox.right - checkBoxWidth;
     }
     else
     {
-        rtext.left += checkBoxWidth + 4;
+        rtext.left += checkBoxWidth + text_offset;
         rbox.right = checkBoxWidth;
     }
 




More information about the wine-cvs mailing list