Endless WM_PAINT loop fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

WordStar for Windows V2 does in its message handler of WM_PAINT:

        rgn=CreateRectRgn(0,0,0,0)
        BeginPaint(hWnd,...)
        <simple drawing code>
        EndPaint(hWnd,...)
        InvalidateRgn(hWnd,rgn,0);

In Wine the InvalidateRgn will create an update region for the window
and set a paint flag. This leads of course to an endless stream of
useless WM_PAINT messages. In Windows this case is probably optimized
away and gives no problems.

Changelog:
	windows		: painting.c
	If RedrawWindow is called with the RDW_INVALIDATE flag, if the 	
	UpdateRgn parameter is a NULLREGION and the Window has no update
	region yet, ignore the call.

Rein. 
-- 
Rein Klazes
rklazes@xxxxxxxxx
--- wine/./windows/painting.c	2003-12-05 07:35:15.000000000 +0100
+++ mywine/./windows/painting.c	2003-12-27 18:51:28.000000000 +0100
@@ -781,6 +781,26 @@
 	}
         dump_rdw_flags(flags);
     }
+    
+    /* this little optimization is actually needed by a program
+     * that does on receving WM_PAINT message:
+     *   rgn=CreateRectRgn(0,0,0,0)
+     *   BeginPaint(hWnd,...)
+     *   ...
+     *   EndPaint(hWnd,...)
+     *   InvalidateRgn(hWnd,rgn,0);
+     *
+     *   The following prevents that the Windows gets an update-
+     *   region and/or that it will generate new WM_PAINT message
+     *   endlessly.
+     */
+    if( flags & RDW_INVALIDATE &&
+            hrgnUpdate &&
+            !wndPtr->hrgnUpdate &&
+            NULLREGION == GetRgnBox(hrgnUpdate, &r) ) {
+        WIN_ReleaseWndPtr(wndPtr);
+        return TRUE;
+    }
 
     /* prepare an update region in window coordinates */
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux