Fix endless WM_PAINT loop take 2.

Rein Klazes rklazes at xs4all.nl
Tue Jan 6 04:03:30 CST 2004


Hi, 

second try to prevent that invalidating a NULL region will cause
WM_PAINT messages.


Changelog:
	windows		: painting.c
	In RDW_UpdateRgn(), if hRgn is zero, clear the windows update
	region if it is an empty region. 

Rein. 
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/windows/painting.c	2003-12-05 07:35:15.000000000 +0100
+++ mywine/windows/painting.c	2004-01-06 10:14:54.000000000 +0100
@@ -460,7 +460,21 @@
 	    wndPtr->hrgnUpdate = (HRGN)1;
 	}
 	else
-	    hRgn = wndPtr->hrgnUpdate;	/* this is a trick that depends on code in PAINT_RedrawWindow() */
+        {
+            /* hRgn is zero */
+            if( wndPtr->hrgnUpdate > (HRGN)1)
+            {
+                GetRgnBox( wndPtr->hrgnUpdate, &r );
+                if( IsRectEmpty( &r ) )
+                {
+                    DeleteObject( wndPtr->hrgnUpdate );
+                    wndPtr->hrgnUpdate = 0;
+                    goto end;
+                }
+            }
+            hRgn = wndPtr->hrgnUpdate;	/* this is a trick that depends
+                                         * on code in RDW_Paint() */
+        }
 
 	if( !bHadOne && !(wndPtr->flags & WIN_INTERNAL_PAINT) )
             add_paint_count( wndPtr->hwndSelf, 1 );
@@ -666,7 +680,7 @@
 		{
 		    if (SendMessageW( hWnd, (bIcon) ? WM_ICONERASEBKGND : WM_ERASEBKGND,
                                       (WPARAM)hDC, 0 ))
-		    wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
+                        wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
 		    ReleaseDC( hWnd, hDC );
 		}
             }


More information about the wine-patches mailing list