ListView painting (was Re: Mouse up vs Mouse click)
Cenedese at indel.ch
Mon Feb 2 08:13:16 CST 2004
>>The mouse tracking in listview happens in the LISTVIEW_TrackMouse()
>>function, which seems correct. It is getting called from only one
>>place (in LISTVIEW_LButtonDown()) so a few print statements there
>>would be nice to see that (1) it is being called, and (2) that it
>>doesn't exit prematurely.
>I made a test and added a printf message in the loop of TrackMouse.
>When I hold the mouse button in the first column I see hundreds of
>these message pass by. But when I press on another column I don't
>even see it enter the whole function TrackMouse, not to mention the
>message from the loop. In LISTVIEW_LButtonDown the nItem is -1,
>so it thinks that no item is selected and skips most of the code.
>I'm still looking at logs. But I also thought that LISTVIEW_HitTest
>gave wrong results for other columns (LVHT_NOWHERE) but I
>still need to look further. But that might go along with the listview
>thinking that no item is selected.
Getting closer. I now know where the problem is though I don't know
the solution. It's in this function:
static INT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select)
if (select && !(uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)))
if (uView == LVS_REPORT)
UnionRect(&rcBounds, &rcIcon, &rcLabel);
UnionRect(&rcBounds, &rcBounds, &rcState);
if (!PtInRect(&rcBounds, opt)) iItem = -1;
return lpht->iItem = iItem;
In the end is this piece of code. What's the intention of it? If my ListCtrl
is LVS_EX_FULLROWSELECT it never enters this code, if my ListCtrl is
not then it enters here but does wrong stuff. If I comment out this code
completely all works fine because right before this the item and subitem
are found correctly.
I have made a little test program I could mail to anyone who's interested
in this. It's just a simple dialog with a list control where you can switch
on and off the OWNERDRAWFIXED and FULLROWSELECT. With the
current wine implementation and FULLROWSELECT set it works
ok (with and without ownerdraw). Without fullrow but with ownerdraw
it gives the errors I've been looking at for weeks. Commenting out the
above code makes it work but then the normal mode (both flags off)
has repainting issues, the items in second or more column stay
selected when moving to another row. But then even the current
implementation is alike.
It could also be that some other places need changes to make all
variations work. But that's again above my head. I tried adding the
ownerdraw flag to this code. Works in my case.
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.380
diff -u -r1.380 listview.c
--- wine/dlls/comctl32/listview.c 10 Dec 2003 00:37:14 -0000 1.380
+++ wine/dlls/comctl32/listview.c 2 Feb 2004 14:09:16 -0000
@@ -5980,7 +5980,8 @@
- if (select && !(uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)))
+ if (select && !(uView == LVS_REPORT && ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
+ || (infoPtr->dwStyle & LVS_OWNERDRAWFIXED))))
if (uView == LVS_REPORT)
More information about the wine-devel