user32: Button should always draw focus rectangle when it has the focus.

Dmitry Timoshkov dmitry at codeweavers.com
Mon Apr 19 07:15:27 CDT 2010


PB_Paint behaved that way before 8d54f582776d590b236e288f9ef8085bb221ccab,
and the original patch didn't had that chunk of code changed. But drawing
focus rectangle only in the case of ODA_FOCUS and ODA_DRAWENTIRE actions
is not correct, for instance BM_SETCHECK/BM_SETSTATE message handlers which
pass ODA_SELECT action need to paint the focus as well.

The application which 8d54f582776d590b236e288f9ef8085bb221ccab was supposed
to fix still works correctly after this patch.
---
 dlls/user32/button.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 0aefe1b..fcacdfb 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -839,8 +839,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
     SetTextColor( hDC, oldTxtColor );
 
 draw_focus:
-    if ((action == ODA_FOCUS) ||
-        ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
+    if (state & BUTTON_HASFOCUS)
     {
         InflateRect( &rc, -2, -2 );
         DrawFocusRect( hDC, &rc );
@@ -969,8 +968,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
 	BUTTON_DrawLabel(hwnd, hDC, dtFlags, &rtext);
 
     /* ... and focus */
-    if ((action == ODA_FOCUS) ||
-        ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
+    if (state & BUTTON_HASFOCUS)
     {
 	rtext.left--;
 	rtext.right++;
@@ -1080,8 +1078,7 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
 					(WPARAM)hDC, (LPARAM)hwnd);
 
     FillRect( hDC, &rc, hBrush );
-    if ((action == ODA_FOCUS) ||
-        ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
+    if (state & BUTTON_HASFOCUS)
         DrawFocusRect( hDC, &rc );
 
     BUTTON_NOTIFY_PARENT( hwnd, BN_PAINT );
-- 
1.7.0.2




More information about the wine-patches mailing list