ownerdraw paint recursion in listbox

Dmitry Timoshkov dmitry at baikal.ru
Thu Jul 28 02:38:14 CDT 2005


"Dmitry Timoshkov" <dmitry at baikal.ru> wrote:

> "Alexander Yaworsky" <yaworsky at migusoft.ru> wrote:
> 
> > http://migusoft.ru/misc/trace.bz2
> >
> > with added ERR()s, see attachment
> >
> > I cut the tail of log just before the first err:listbox. Note that
> > there are two listboxes on the form. Both are initialized ok,
> > wrong things begin after WM_KEYDOWN.
> 
> Thanks, now I see where the problem is. In responce to WM_DRAWITEM the app does:
> 
> SendMessage(hwndListbox, LB_GETITEMRECT, 0, &rc);
> InvalidateRect(hwndListbox, &rc, FALSE);
> UpdateWindow(hwndListbox);
> 
> which leads to an infinite loop.

While browsing my old not answered e-mails I've found this one. Does
the attached patch help? It restricts the control to draw outside of
the item rect but not the whole control rect as it currently does.

-- 
Dmitry.
-------------- next part --------------
--- cvs/hq/wine/dlls/user/listbox.c	2005-07-13 17:56:48.000000000 +0900
+++ wine/dlls/user/listbox.c	2005-07-28 16:22:34.000000000 +0900
@@ -540,7 +540,6 @@ static void LISTBOX_PaintItem( LB_DESCR 
     if (IS_OWNERDRAW(descr))
     {
         DRAWITEMSTRUCT dis;
-        RECT r;
         HRGN hrgn;
         UINT id = (UINT)GetWindowLongPtrW( descr->self, GWLP_ID );
 
@@ -557,8 +556,7 @@ static void LISTBOX_PaintItem( LB_DESCR 
         drawing the item, *and* restore the previous region
         after they are done, so a region has better to exist
         else everything ends clipped */
-        GetClientRect(descr->self, &r);
-        hrgn = CreateRectRgnIndirect(&r);
+        hrgn = CreateRectRgnIndirect(rect);
         SelectClipRgn( hdc, hrgn);
         DeleteObject( hrgn );
 


More information about the wine-devel mailing list