Commit 00e75f2b authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Reimplement MENU_FindSubMenu on the 16-bit side using only exported functions.

parent d4a7a9d4
......@@ -158,7 +158,6 @@ extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt ) DECLSPEC_HIDDE
extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar ) DECLSPEC_HIDDEN;
extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HWND hwnd, BOOL suppress_draw ) DECLSPEC_HIDDEN;
extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget ) DECLSPEC_HIDDEN;
extern void MENU_EndMenu(HWND) DECLSPEC_HIDDEN;
/* nonclient area */
......
......@@ -656,7 +656,7 @@ static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
* *hmenu in case it is found in another sub-menu.
* If the submenu cannot be found, NO_SELECTED_ITEM is returned.
*/
UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget )
static UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget )
{
POPUPMENU *menu;
UINT i;
......
......@@ -587,6 +587,24 @@ static HANDLE16 convert_handle_32_to_16(UINT_PTR src, unsigned int flags)
return dst;
}
static int find_sub_menu( HMENU *hmenu, HMENU16 target )
{
int i, pos, count = GetMenuItemCount( *hmenu );
for (i = 0; i < count; i++)
{
HMENU sub = GetSubMenu( *hmenu, i );
if (!sub) continue;
if (HMENU_16(sub) == target) return i;
if ((pos = find_sub_menu( &sub, target )) != -1)
{
*hmenu = sub;
return pos;
}
}
return -1;
}
/**********************************************************************
* WINPROC_CallProc16To32A
*/
......@@ -825,8 +843,8 @@ LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT1
if((LOWORD(lParam) & MF_POPUP) && (LOWORD(lParam) != 0xFFFF))
{
HMENU hmenu = HMENU_32(HIWORD(lParam));
UINT pos = MENU_FindSubMenu( &hmenu, HMENU_32(wParam) );
if (pos == 0xffff) pos = 0; /* NO_SELECTED_ITEM */
int pos = find_sub_menu( &hmenu, wParam );
if (pos == -1) pos = 0;
wParam = pos;
}
ret = callback( hwnd32, msg, MAKEWPARAM( wParam, LOWORD(lParam) ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment