On Mon, Apr 23, 2018 at 12:31:21PM +0300, Nikolay Sivov wrote:
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/user32/menu.c | 544 ++++++++++++++++++++++++++++++--------------- 1 file changed, 369 insertions(+), 175 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 537c2ebe1a..dcec42cdf2 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -592,52 +592,56 @@ 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 MENUITEM *MENU_FindItem(POPUPMENU **menu, UINT *nPos, UINT wFlags) {
Perhaps it would be better to introduce some new functions here - the [in, out] nature of the first two params is ugly. Many callers don't need the menu or the position back, so how about: MENUITEM *find_item( POPUPMENU *menu, UINT id, UINT flags ) for those cases. That could be written in terms of MENU_FindItem() (for now) and callers that only need the item could be moved first. The rest could call something like: MENUITEM *find_item_and_popup( POPUPMENU *menu, UINT id, UINT flags, POPUPMENU **popup, UINT *pos ) which on success would always return a properly ref counted menu in *popup (either the original or a submenu). Huw.