Uncleared WM_PAINT loop problem

Dave Hawkes daveh-wine at cadlink.com
Thu Dec 13 15:39:48 CST 2001


Yes, the new code fixes my problem, but there may still be other problems.

Note that the MS documentation on WM_PAINT states:

A window may receive internal paint messages as a result of calling
RedrawWindow with the RDW_INTERNALPAINT flag set. In this case, the window
may not have an update region. An application should call the GetUpdateRect
function to determine whether the window has an update region. If
GetUpdateRect returns zero, the application should not call the BeginPaint
and EndPaint functions.

So if we have no update area we should not rely on BeginPaint clearing it
anyway as an app. may not call BeginPaint (Of course this should only occur
with an internal paint).

Dave Hawkes


----- Original Message -----
From: "Gerard Patel" <gerard.patel at nerim.net>
To: "Dave Hawkes" <daveh-wine at cadlink.com>
Cc: <wine-devel at winehq.com>
Sent: Thursday, December 13, 2001 5:29 PM
Subject: Re: Uncleared WM_PAINT loop problem


> At 02:13 PM 12/12/2001 -0500, you wrote:
> >I have a problem where an edit control get stuck in an infinite WM_PAINT
> >loop.
> >
> >BeginPaint never clears the paint count because of this code:
> >
> > if(((hrgnUpdate = wndPtr->hrgnUpdate) != 0) || (wndPtr->flags &
> >WIN_INTERNAL_PAINT))
> >        add_paint_count( hwnd, -1 );
> >
> >
> >if wndPtr->hrgnUpdate is 0 then the paint count is never decremented here
> >and nowhere else attempts to decrement it and we land up in an infinite
> >paint loop. I'm not sure how we get to this point the a NULL update
region
> >(which may be a bug anyway), but there should still be a method of
breaking
> >out of this loop once we are there.
> >
> >I tried removing the test and always calling add_paint_count and this
> >appears to fix the problem.
> >
>
> With current Cvs code the infinite loop should have gone away...
> Alexandre Julliard has changed a strangeness of BeginPaint :
> when the update region is null, Wine used to paint the whole
> window. New code set an empty painting rectangle.
>
> However, if the empty update region comes from an earlier Wine
> bug, the new code replaces excessive repainting with no
> repainting at all.
> I have already an app that shows this problem. As I was saying in
> reply to Andi Mohr, better code can reveal better old bugs...
>
> Gerard
>
>
>
>





More information about the wine-devel mailing list