From 13ffd58a1f55f9aa2f222ac492d4b7bb0b89221b Mon Sep 17 00:00:00 2001
From: Sheri Steeves <sheri@macadamian.com>
Date: Sun, 11 Jun 2000 20:08:46 +0000
Subject: [PATCH] Added save and reset of SetBKMode values in WM_PAINT. Added
 handling of lParam value in BM_SETSTYLE.

---
 controls/button.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/controls/button.c b/controls/button.c
index 671bb117477..afeafe19676 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -133,8 +133,9 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
         {
             PAINTSTRUCT ps;
             HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
-	    SetBkMode( hdc, OPAQUE );
+            int nOldMode = SetBkMode( hdc, OPAQUE );
             (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
+            SetBkMode(hdc, nOldMode); /*  reset painting mode */
             if( !wParam ) EndPaint( hWnd, &ps );
         }
         break;
@@ -266,7 +267,11 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
         wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0) 
                            | (wParam & 0x0000000f);
         style = wndPtr->dwStyle & 0x0000000f;
-        PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+
+        /* Only redraw if lParam flag is set.*/
+        if (lParam)
+           PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
+
         break;
 
     case BM_CLICK:
-- 
GitLab