[v2 PATCH] user32/menu: Return locked menu data when looking for menu items.

Huw Davies huw at codeweavers.com
Mon Apr 30 02:47:17 CDT 2018


On Wed, Apr 25, 2018 at 07:27:36PM +0300, Nikolay Sivov wrote:
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
> 
> This hopefully addresses comments I got for original patch. It takes
> handle on input, and returns locked menu data and item pointer in a single
> structure.
> 
>  dlls/user32/menu.c | 566 ++++++++++++++++++++++++++++-----------------
>  1 file changed, 359 insertions(+), 207 deletions(-)
> 
> diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
> index 537c2ebe1a..5778af2a0a 100644
> --- a/dlls/user32/menu.c
> +++ b/dlls/user32/menu.c
> @@ -584,7 +584,12 @@ static UINT  MENU_GetStartOfPrevColumn(
>      return i;
>  }
>  
> -
> +struct menu_item_desc
> +{
> +    MENUITEM *item;
> +    POPUPMENU *menu;
> +    UINT id;
> +};
>  
>  /***********************************************************************
>   *           MENU_FindItem
> @@ -592,18 +597,29 @@ static UINT  MENU_GetStartOfPrevColumn(
>   * Find a menu item. Return a pointer on the item, and modifies *hmenu
>   * in case the item was in a sub-menu.
>   */
> -static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
> +static BOOL MENU_FindItem(HMENU hmenu, UINT wFlags, struct menu_item_desc *desc)
>  {

IMHO using the 'id' member of desc as an [in,out] param is confusing,
not least because of its name.  I'd suggest changing the name to 'pos'
and using it as [out]-only, then adding a UINT 'id' parameter to the
function.

Huw.



More information about the wine-devel mailing list