[PATCH] painting treeview in a memory DC

gerard patel gerard.patel at asi.fr
Sun Apr 1 19:05:03 CDT 2001


Using wincvs (http://www.cvsgui.org/download.html), only the first line of the Explore panel is
drawn, and  the background is garbage. Looking at the code (it's available) it can be seen that
the app calls BeginPaint, create a compatible DC, calls CallWindowProc to let the default
handler (Wine) do its job, then redraws some part of the treeview in the memory DC, and
finally bitblt the memory DC into the  real one.

First problem : current CVS use GetUpdateRect to get the area to repaint, in this case the rect
is empty since BeginPaint was called just before.
Second problem : nothing erases the memory DC.

I have left the current code in place since I don't know if was written for a case I
have never seen.

ChangeLog:

	* dlls/comctl32/treeview.c
                   erase the in-memory DC for treeview and fixes the rectangle calculation
-------------- next part --------------
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.89
diff -u -r1.89 treeview.c
--- dlls/comctl32/treeview.c	2001/02/20 23:43:21	1.89
+++ dlls/comctl32/treeview.c	2001/04/01 23:52:01
@@ -2619,7 +2619,18 @@
     if (wParam)
     {
         hdc = (HDC)wParam;
-        GetUpdateRect(infoPtr->hwnd, &rc, TRUE);
+        if (!GetUpdateRect(infoPtr->hwnd, &rc, TRUE))
+        {
+            HBITMAP hbitmap;
+            BITMAP bitmap;
+            hbitmap = GetCurrentObject(hdc, OBJ_BITMAP);
+            if (!hbitmap) return 0;
+            GetObjectA(hbitmap, sizeof(BITMAP), &bitmap);
+            rc.left = 0; rc.top = 0;
+            rc.right = bitmap.bmWidth;
+            rc.bottom = bitmap.bmHeight;  
+            TREEVIEW_EraseBackground(infoPtr, wParam);
+        }
     }
     else
     {
-------------- next part --------------



More information about the wine-patches mailing list