user32: Draw the whole button only if requested. Take 2.

Dmitry Timoshkov dmitry at codeweavers.com
Wed Jul 22 04:56:42 CDT 2009


The application I'm working on relies on this, it doesn't expect that
button completely redraws itself on WM_SETFOCUS/WM_KILLFOCUS messages.

This version of the patch skips the button drawing in the case
of action == ODA_FOCUS.
---
 dlls/user32/button.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index a61a4e7..59a581e 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -826,6 +826,9 @@ 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);
@@ -869,6 +872,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
 
     SetTextColor( hDC, oldTxtColor );
 
+draw_focus:
     if (state & BUTTON_HASFOCUS)
     {
         InflateRect( &focus_rect, -1, -1 );
-- 
1.6.3.3




More information about the wine-patches mailing list