user32: Make sure that focus_rect is always initialized.

Dmitry Timoshkov dmitry at codeweavers.com
Mon Oct 12 03:20:40 CDT 2009


---
 dlls/user32/button.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 1681949..fbe4c82 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -826,15 +826,18 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
     hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
     oldBkMode = SetBkMode(hDC, TRANSPARENT);
 
-    /* completely skip the drawing if only focus has changed */
-    if (action == ODA_FOCUS) goto draw_focus;
-
     if (get_button_type(style) == BS_DEFPUSHBUTTON)
     {
-        Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
+        if (action != ODA_FOCUS)
+            Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
 	InflateRect( &rc, -1, -1 );
     }
 
+    focus_rect = rc;
+
+    /* completely skip the drawing if only focus has changed */
+    if (action == ODA_FOCUS) goto draw_focus;
+
     uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT;
 
     if (style & BS_FLAT)
@@ -852,8 +855,6 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
 
     DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
 
-    focus_rect = rc;
-
     /* draw button label */
     r = rc;
     dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &r);
-- 
1.6.4.2




More information about the wine-patches mailing list