[PATCH] comctl32/listview: Keep the active item selected after hwndEdit is destroyed

Nikolay Sivov bunglehead at gmail.com
Thu Aug 17 15:37:00 CDT 2017


On 10.08.2017 7:54, Hugh McMaster wrote:
> Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
> ---
>  dlls/comctl32/listview.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
> index 73eceff509..05bd375571 100644
> --- a/dlls/comctl32/listview.c
> +++ b/dlls/comctl32/listview.c
> @@ -10216,6 +10216,7 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
>    static BOOL bGroupSelect = TRUE;
>    POINT pt = { x, y };
>    INT nItem;
> +  BOOL editing = FALSE;
>  
>    TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
>  
> @@ -10309,11 +10310,20 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
>    else
>    {
>      if (!infoPtr->bFocus)
> +    {
> +        editing = IsWindow(infoPtr->hwndEdit);
>          SetFocus(infoPtr->hwndSelf);
> +    }
>  
> -    /* remove all selections */
> +    /* keep the active item selected after hwndEdit is destroyed, or deselect all items */
>      if (!(wKey & MK_CONTROL) && !(wKey & MK_SHIFT))
> -        LISTVIEW_DeselectAll(infoPtr);
> +    {
> +        if (editing)
> +            LISTVIEW_DeselectAllSkipItem(infoPtr, infoPtr->nFocusedItem);
> +        else
> +            LISTVIEW_DeselectAll(infoPtr);
> +    }
> +

Maybe this could be reduced to a single unconditional call:

LISTVIEW_DeselectAllSkipItem(infoPtr, infoPtr->nEditLabelItem);

>      ReleaseCapture();
>    }
>    
> 




More information about the wine-devel mailing list