Get rid of the WIN_NEEDS_BEGINPAINT flag, Windows will happily loop

forever too if WM_PAINT is not handled properly.
This commit is contained in:
Alexandre Julliard 2004-10-30 02:13:48 +00:00
parent 96ca3ac687
commit bcb1f8fe05
4 changed files with 6 additions and 66 deletions

View File

@ -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;
}

View File

@ -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 );

View File

@ -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 */

View File

@ -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;
}