[PATCH 2/2] user32/combo: Fix listbox_size calculation

Nikolay Sivov nsivov at codeweavers.com
Fri Feb 22 12:39:09 CST 2019


On 2/22/19 9:22 PM, Fabian Maurer wrote:

> Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
> ---
>   dlls/user32/combo.c       |  4 ++++
>   dlls/user32/tests/combo.c | 10 +++++-----
>   2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
> index 59c2e6484c..10fbed6a7f 100644
> --- a/dlls/user32/combo.c
> +++ b/dlls/user32/combo.c
> @@ -1025,6 +1025,10 @@ static void CBDropDown( LPHEADCOMBO lphc )
>
>         nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
>
> +      nDroppedHeight--;
> +      if (nDroppedHeight < nIHeight + COMBO_YBORDERSIZE())
> +         nDroppedHeight = COMBO_YBORDERSIZE();
> +
>         nHeight = nIHeight*nItems;
>
>         if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())

This doesn't look good. What does decrement by 1 mean in this context, 
and why it's exactly 1?

Right after this block there is another fixup condition for 
nDroppedHeight, could it be merged?

Does the same apply to comctl32 copy?

> diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
> index 12e4ed5862..ed945180bc 100644
> --- a/dlls/user32/tests/combo.c
> +++ b/dlls/user32/tests/combo.c
> @@ -689,7 +689,7 @@ static void test_listbox_size(DWORD style)
>           BOOL todo;
>       } info_height[] = {
>           {2, 24, FALSE},
> -        {2, 41, TRUE},
> +        {2, 41, FALSE},
>           {2, 42, FALSE},
>           {2, 50, FALSE},
>           {2, 60, FALSE},
> @@ -697,17 +697,17 @@ static void test_listbox_size(DWORD style)
>           {2, 89, FALSE},
>           {2, 90, FALSE},
>           {2, 100, FALSE},
> -        {3, 73, TRUE},
> +        {3, 73, FALSE},
>
>           {10, 24, FALSE},
> -        {10, 40, TRUE},
> -        {10, 41, TRUE},
> +        {10, 40, FALSE},
> +        {10, 41, FALSE},
>           {10, 42, FALSE},
>           {10, 50, FALSE},
>           {10, 60, FALSE},
>           {10, 80, FALSE},
>           {10, 88, FALSE},
> -        {10, 89, TRUE},
> +        {10, 89, FALSE},
>           {10, 90, FALSE},
>           {10, 100, FALSE},
>       };
> --
> 2.20.1
>
>
>



More information about the wine-devel mailing list