From bcb1f8fe05aef4a6b5a2babb56dd8063c5547a39 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 30 Oct 2004 02:13:48 +0000 Subject: [PATCH] Get rid of the WIN_NEEDS_BEGINPAINT flag, Windows will happily loop forever too if WM_PAINT is not handled properly. --- dlls/user/msg16.c | 23 +---------------------- dlls/user/painting.c | 2 +- include/win.h | 1 - windows/message.c | 46 ++++------------------------------------------ 4 files changed, 6 insertions(+), 66 deletions(-) diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c index 65b3463f3ca..ab2e228f679 100644 --- a/dlls/user/msg16.c +++ b/dlls/user/msg16.c @@ -254,7 +254,6 @@ LONG WINAPI DispatchMessage16( const MSG16* msg ) WND * wndPtr; WNDPROC16 winproc; LONG retval; - int painting; HWND hwnd = WIN_Handle32( msg->hwnd ); /* Process timer messages */ @@ -285,33 +284,13 @@ LONG WINAPI DispatchMessage16( const MSG16* msg ) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); return 0; } - - if (!(winproc = (WNDPROC16)wndPtr->winproc)) - { - WIN_ReleasePtr( wndPtr ); - return 0; - } - painting = (msg->message == WM_PAINT); - if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; + winproc = (WNDPROC16)wndPtr->winproc; WIN_ReleasePtr( wndPtr ); SPY_EnterMessage( SPY_DISPATCHMESSAGE16, hwnd, msg->message, msg->wParam, msg->lParam ); retval = CallWindowProc16( winproc, msg->hwnd, msg->message, msg->wParam, msg->lParam ); SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg->message, retval, msg->wParam, msg->lParam ); - if (painting && (wndPtr = WIN_GetPtr( hwnd )) && (wndPtr != WND_OTHER_PROCESS)) - { - BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate); - wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; - WIN_ReleasePtr( wndPtr ); - if (validate) - { - ERR( "BeginPaint not called on WM_PAINT for hwnd %p!\n", hwnd ); - /* Validate the update region to avoid infinite WM_PAINT loop */ - RedrawWindow( hwnd, NULL, 0, - RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT ); - } - } return retval; } diff --git a/dlls/user/painting.c b/dlls/user/painting.c index 53bad6d55a3..314aa1c3921 100644 --- a/dlls/user/painting.c +++ b/dlls/user/painting.c @@ -159,7 +159,7 @@ static HRGN begin_ncpaint( HWND hwnd ) if (wnd->hrgnUpdate || (wnd->flags & WIN_INTERNAL_PAINT)) add_paint_count( hwnd, -1 ); if (wnd->hrgnUpdate > (HRGN)1) DeleteObject( wnd->hrgnUpdate ); wnd->hrgnUpdate = 0; - wnd->flags &= ~(WIN_INTERNAL_PAINT | WIN_NEEDS_NCPAINT | WIN_NEEDS_BEGINPAINT); + wnd->flags &= ~(WIN_INTERNAL_PAINT | WIN_NEEDS_NCPAINT); if (client_rgn > (HRGN)1) OffsetRgn( client_rgn, wnd->rectWindow.left - wnd->rectClient.left, wnd->rectWindow.top - wnd->rectClient.top ); WIN_ReleasePtr( wnd ); diff --git a/include/win.h b/include/win.h index 6f9964a5adb..bc29a0d6b47 100644 --- a/include/win.h +++ b/include/win.h @@ -78,7 +78,6 @@ typedef struct } INTERNALPOS, *LPINTERNALPOS; /* WND flags values */ -#define WIN_NEEDS_BEGINPAINT 0x0001 /* WM_PAINT sent to window */ #define WIN_NEEDS_ERASEBKGND 0x0002 /* WM_ERASEBKGND must be sent to window*/ #define WIN_NEEDS_NCPAINT 0x0004 /* WM_NCPAINT must be sent to window */ #define WIN_RESTORE_MAX 0x0008 /* Maximize when restoring */ diff --git a/windows/message.c b/windows/message.c index 8fdf60bd964..02a116e0c98 100644 --- a/windows/message.c +++ b/windows/message.c @@ -749,7 +749,6 @@ LONG WINAPI DispatchMessageA( const MSG* msg ) { WND * wndPtr; LONG retval; - int painting; WNDPROC winproc; /* Process timer messages */ @@ -787,14 +786,9 @@ LONG WINAPI DispatchMessageA( const MSG* msg ) WIN_ReleasePtr( wndPtr ); return 0; } - if (!(winproc = wndPtr->winproc)) - { - WIN_ReleasePtr( wndPtr ); - return 0; - } - painting = (msg->message == WM_PAINT); - if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; + winproc = wndPtr->winproc; WIN_ReleasePtr( wndPtr ); + /* hook_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, @@ -804,19 +798,6 @@ LONG WINAPI DispatchMessageA( const MSG* msg ) SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval, msg->wParam, msg->lParam ); - if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS)) - { - BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate); - wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; - WIN_ReleasePtr( wndPtr ); - if (validate) - { - ERR( "BeginPaint not called on WM_PAINT for hwnd %p!\n", msg->hwnd ); - /* Validate the update region to avoid infinite WM_PAINT loop */ - RedrawWindow( msg->hwnd, NULL, 0, - RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT ); - } - } return retval; } @@ -846,7 +827,6 @@ LONG WINAPI DispatchMessageW( const MSG* msg ) { WND * wndPtr; LONG retval; - int painting; WNDPROC winproc; /* Process timer messages */ @@ -884,14 +864,9 @@ LONG WINAPI DispatchMessageW( const MSG* msg ) WIN_ReleasePtr( wndPtr ); return 0; } - if (!(winproc = wndPtr->winproc)) - { - WIN_ReleasePtr( wndPtr ); - return 0; - } - painting = (msg->message == WM_PAINT); - if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; + winproc = wndPtr->winproc; WIN_ReleasePtr( wndPtr ); + /* HOOK_CallHooks32W( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, @@ -901,19 +876,6 @@ LONG WINAPI DispatchMessageW( const MSG* msg ) SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval, msg->wParam, msg->lParam ); - if (painting && (wndPtr = WIN_GetPtr( msg->hwnd )) && (wndPtr != WND_OTHER_PROCESS)) - { - BOOL validate = ((wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate); - wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; - WIN_ReleasePtr( wndPtr ); - if (validate) - { - ERR( "BeginPaint not called on WM_PAINT for hwnd %p!\n", msg->hwnd ); - /* Validate the update region to avoid infinite WM_PAINT loop */ - RedrawWindow( msg->hwnd, NULL, 0, - RDW_NOFRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT ); - } - } return retval; } -- 2.11.4.GIT