[PATCH v2 resend 4/6] comctl32/listview: Send LVN_ODSTATECHANGED notification.

Zhiyi Zhang zzhang at codeweavers.com
Fri Jun 10 03:13:25 CDT 2022



On 5/26/22 04:00, Angelo Haller wrote:
> From: Angelo Haller <angelo at szanni.org>
>
> Send LVN_ODSTATECHANGED notification on selection change for
> listviews when LVS_OWNERDATA is set.
>
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52534
> Signed-off-by: Angelo Haller <angelo at szanni.org>
> ---
>  dlls/comctl32/listview.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
> index 318df0a4093..3c3f5af2a27 100644
> --- a/dlls/comctl32/listview.c
> +++ b/dlls/comctl32/listview.c
> @@ -3597,6 +3597,8 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
>   */
>  static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
>  {
> +    INT nFirst = -1;
> +    INT nLast = -1;

Let's merge it to a single line.

>      RANGES selection;
>      DWORD old_mask;
>      LVITEMW item;
> @@ -3648,21 +3650,25 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
>  	iterator_destroy(&i);
>      }
>  
> -    /* disable per item notifications on LVS_OWNERDATA style
> -       FIXME: single LVN_ODSTATECHANGED should be used */
> +    /* disable per item notifications on LVS_OWNERDATA style */
>      old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
>      if (infoPtr->dwStyle & LVS_OWNERDATA)
>          infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
>  
>      LISTVIEW_DeselectAllSkipItems(infoPtr, selection);
>  
> -
>      iterator_rangesitems(&i, selection);
> -    while(iterator_next(&i))
> -	LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
> +    while(iterator_next(&i)) {
> +        if (nFirst == -1)
> +            nFirst = i.nItem;
> +        nLast = i.nItem;
> +        LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
> +    }
>      /* this will also destroy the selection */
>      iterator_destroy(&i);
>  
> +    LISTVIEW_SetOwnerDataState(infoPtr, nFirst, nLast, &item);
> +
>      infoPtr->notify_mask |= old_mask;
>      LISTVIEW_SetItemFocus(infoPtr, nItem);
>  }




More information about the wine-devel mailing list