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

Nikolay Sivov nsivov at codeweavers.com
Wed Oct 11 04:53:20 CDT 2017


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
>




More information about the wine-devel mailing list