PATCH: wrong clipRect when CS_PARENTDC and WS_CLIPSIBLINGS styles are combined

Alexandre Julliard julliard at winehq.com
Fri Jul 27 19:14:35 CDT 2001


lsla at post.cz writes:

> Where the Wine's GetClipRect returns the area of the parent, the
> Windows version returns only the area of the child. Therefore in
> Wine the WM_ERASEBKGND message erases the whole parent including the
> other radio buttons.

I think GetClipBox is correct, the problem is that the WM_ERASEBKGND
handler should not be using it, but GetClientRect. You can try this:

Index: windows/defwnd.c
===================================================================
RCS file: /opt/cvs-commit/wine/windows/defwnd.c,v
retrieving revision 1.57
diff -u -r1.57 defwnd.c
--- windows/defwnd.c	2001/06/20 23:16:34	1.57
+++ windows/defwnd.c	2001/07/27 23:47:26
@@ -457,20 +457,15 @@
     case WM_ICONERASEBKGND:
 	{
 	    RECT rect;
+            HDC hdc = (HDC)wParam;
             HBRUSH hbr = GetClassLongW( wndPtr->hwndSelf, GCL_HBRBACKGROUND );
             if (!hbr) return 0;
 
-	    /*  Since WM_ERASEBKGND may receive either a window dc or a    */ 
-	    /*  client dc, the area to be erased has to be retrieved from  */
-	    /*  the device context.      				   */
-	    GetClipBox( (HDC)wParam, &rect );
-
-            /* Always call the Win32 variant of FillRect even on Win16,
-             * since despite the fact that Win16, as well as Win32,
-             * supports special background brushes for a window class,
-             * the Win16 variant of FillRect does not.
-             */
-            FillRect( (HDC) wParam, &rect, hbr );
+            /* GetClientRect used to be GetClipBox, but it is not what
+             * Windows does, and it breaks badly with CS_PARENTDC */
+            GetClientRect( wndPtr->hwndSelf, &rect );
+            DPtoLP( hdc, (LPPOINT)&rect, 2 );
+            FillRect( hdc, &rect, hbr );
 	    return 1;
 	}
 

-- 
Alexandre Julliard
julliard at winehq.com




More information about the wine-devel mailing list