user32: Draw the whole button only if requested. Take 3.
Dmitry Timoshkov
dmitry at codeweavers.com
Thu Jul 23 05:44:13 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 patch copies what other button painting routines do.
---
dlls/user32/button.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index a61a4e7..1681949 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,7 +872,9 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetTextColor( hDC, oldTxtColor );
- if (state & BUTTON_HASFOCUS)
+draw_focus:
+ if ((action == ODA_FOCUS) ||
+ ((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
{
InflateRect( &focus_rect, -1, -1 );
IntersectRect(&focus_rect, &focus_rect, &rc);
--
1.6.3.3
More information about the wine-patches
mailing list