user32: Draw the whole button only if requested.

This commit is contained in:
Dmitry Timoshkov 2009-07-23 19:44:13 +09:00 committed by Alexandre Julliard
parent 6b15db8717
commit 8d54f58277
1 changed files with 6 additions and 1 deletions

View File

@ -826,6 +826,9 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE)); hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
oldBkMode = SetBkMode(hDC, TRANSPARENT); 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) if (get_button_type(style) == BS_DEFPUSHBUTTON)
{ {
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
@ -869,7 +872,9 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetTextColor( hDC, oldTxtColor ); SetTextColor( hDC, oldTxtColor );
if (state & BUTTON_HASFOCUS) draw_focus:
if ((action == ODA_FOCUS) ||
((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
{ {
InflateRect( &focus_rect, -1, -1 ); InflateRect( &focus_rect, -1, -1 );
IntersectRect(&focus_rect, &focus_rect, &rc); IntersectRect(&focus_rect, &focus_rect, &rc);