From 0fe60f83d227bf70f6cb4a2d7983d6fd654edba9 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 19 Oct 2015 20:16:50 +0800 Subject: [PATCH] user32: Always call BeginPaint/EndPaint when handling a WM_PAINT message for the button. 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. Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- 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 9a10b86a65f..eeb3035bb68 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)