comctl32: listview: Make LVM_GETCOLUMNWIDTH query the header control instead of using cached data.
This commit is contained in:
parent
f83b53c160
commit
a1b55be693
|
@ -5147,7 +5147,7 @@ static BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCoun
|
||||||
static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
|
static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
|
||||||
{
|
{
|
||||||
INT nColumnWidth = 0;
|
INT nColumnWidth = 0;
|
||||||
RECT rcHeader;
|
HDITEMW hdItem;
|
||||||
|
|
||||||
TRACE("nColumn=%d\n", nColumn);
|
TRACE("nColumn=%d\n", nColumn);
|
||||||
|
|
||||||
|
@ -5158,9 +5158,19 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
|
||||||
nColumnWidth = infoPtr->nItemWidth;
|
nColumnWidth = infoPtr->nItemWidth;
|
||||||
break;
|
break;
|
||||||
case LVS_REPORT:
|
case LVS_REPORT:
|
||||||
if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0;
|
/* We are not using LISTVIEW_GetHeaderRect as this data is updated only after a HDM_ITEMCHANGED.
|
||||||
LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcHeader);
|
* There is an application that subclasses the listview, calls LVM_GETCOLUMNWIDTH in the
|
||||||
nColumnWidth = rcHeader.right - rcHeader.left;
|
* HDM_ITEMCHANGED handler and goes into infinite recursion if it receives old data.
|
||||||
|
*
|
||||||
|
* TODO: should we do the same in LVM_GETCOLUMN?
|
||||||
|
*/
|
||||||
|
hdItem.mask = HDI_WIDTH;
|
||||||
|
if (!SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdItem))
|
||||||
|
{
|
||||||
|
WARN("(%p): HDM_GETITEMW failed for item %d\n", infoPtr->hwndSelf, nColumn);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
nColumnWidth = hdItem.cxy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue