user32: Always call BeginPaint/EndPaint when handling a WM_PAINT message for the button.

Dmitry Timoshkov dmitry at baikal.ru
Mon Oct 19 07:16:50 CDT 2015


Python 3.5 installer creates windows with class "Button" that have 0x000e
button style, that causes infinite painting loops and inability to draw
the installer UI. This patch fixes this problem and makes the Python 3.5
installer UI usable.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/user32/button.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 9a10b86..eeb3035 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -282,16 +282,18 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
 
     case WM_PRINTCLIENT:
     case WM_PAINT:
+    {
+        PAINTSTRUCT ps;
+        HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
         if (btnPaintFunc[btn_type])
         {
-            PAINTSTRUCT ps;
-            HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
             int nOldMode = SetBkMode( hdc, OPAQUE );
             (btnPaintFunc[btn_type])( hWnd, hdc, ODA_DRAWENTIRE );
             SetBkMode(hdc, nOldMode); /*  reset painting mode */
-            if( !wParam ) EndPaint( hWnd, &ps );
         }
+        if ( !wParam ) EndPaint( hWnd, &ps );
         break;
+    }
 
     case WM_KEYDOWN:
 	if (wParam == VK_SPACE)
-- 
2.6.2




More information about the wine-patches mailing list