[resend 2/2] comctl32: Enhance LISTVIEW_ApproximateViewRect in LV_VIEW_DETAILS mode.

Nikolay Sivov nsivov at codeweavers.com
Wed Oct 11 08:55:28 CDT 2017


On 11.10.2017 14:46, Vadim Druzhin wrote:
>
>
>> Среда, 11 октября 2017, 12:53 +03:00 от Nikolay Sivov <nsivov at codeweavers.com>:
>>
>> On 10/11/2017 10:11 AM, Vadim Druzhin wrote:
>>
>>> Calculate approximated window size
>>> when control does not have real items.
>>>
>>> Fix for NTPWEdit (http://cdslow.org.ru/en/ntpwedit/index.html).
>>>
>>> Signed-off-by: Vadim Druzhin < cdslow at mail.ru >
>>> ---
>>>   dlls/comctl32/listview.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
>>> index  8114222 ..7e33f7c 100644
>>> --- a/dlls/comctl32/listview.c
>>> +++ b/dlls/comctl32/listview.c
>>> @@ -5362,6 +5362,13 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
>>>         wWidth = rcBox.right - rcBox.left;
>>>         wHeight = (rcBox.bottom - rcBox.top) * nItemCount;
>>>       }
>>> +    else if (nItemCount > 0)
>>> +    {
>>> +      /* No real items, use approximation */
>>> +      LISTVIEW_GetHeaderRect(infoPtr, 0, &rcBox);
>>> +      wHeight = rcBox.bottom - rcBox.top + infoPtr->nItemHeight * nItemCount;
>>> +      wWidth = infoPtr->nItemWidth;
>>> +    }
>> Hi, Vadim.
>>
>> This doesn't look right. nItemCount less than -1 or 0 is acceptable too, 
>> only -1 has special meaning. Please add some tests to 
>> ./tests/listview.c:test_approximate_viewrect() first. Currently we only 
>> have some tests, and not that many, for LVS_ICON style.
>>>       else
>>>       {
>>>         /* use current height and width */
>>> --
>>> 2.5.5
>>>
>>
> For case with nItemCount less than -1 or 0 will be executed old code from else branch (return current window size).
> Behavior changed only when nItemCount > 0 but infoPtr->nItemCount <= 0.
Yes, my point is that limiting your new code to nItemCount > 0 does not
look right. Anyway, like I said it need some tests first.





More information about the wine-devel mailing list