From fcd352152fed7bab60bffb0707b5f2f7660dd242 Mon Sep 17 00:00:00 2001
From: Dave Hawkes <daveh-wine@cadlink.com>
Date: Sat, 15 Jul 2000 21:31:42 +0000
Subject: [PATCH] All standard window controls should have CS_PARENTDC, but
 should still clip to the control window.

---
 controls/button.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/controls/button.c b/controls/button.c
index 51bd46c8269..0a14594a6ea 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -921,6 +921,8 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
 {
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
     DRAWITEMSTRUCT dis;
+    HRGN clipRegion;
+    RECT clipRect;
 
     dis.CtlType    = ODT_BUTTON;
     dis.CtlID      = wndPtr->wIDmenu;
@@ -934,9 +936,21 @@ static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
     dis.itemData   = 0;
     GetClientRect( wndPtr->hwndSelf, &dis.rcItem );
 
+    clipRegion = CreateRectRgnIndirect(&dis.rcItem);   
+    if (GetClipRgn(hDC, clipRegion) != 1)
+    {
+	DeleteObject(clipRegion);
+	clipRegion=(HRGN)NULL;
+    }
+    clipRect = dis.rcItem;
+    DPtoLP(hDC, (LPPOINT) &clipRect, 2);    
+    IntersectClipRect(hDC, clipRect.left,  clipRect.top, clipRect.right, clipRect.bottom);
+
     SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) );
 
     SendMessageA( GetParent(wndPtr->hwndSelf), WM_DRAWITEM,
                     wndPtr->wIDmenu, (LPARAM)&dis );
+
+    SelectClipRgn(hDC, clipRegion);		
 }
 
-- 
GitLab