win32u: Move NtUserGetMenuItemRect implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-20 15:57:02 +02:00 committed by Alexandre Julliard
parent d275253f5d
commit 19a2af2767
8 changed files with 57 additions and 49 deletions

View File

@ -4262,13 +4262,13 @@ BOOL WINAPI GetMenuBarInfo( HWND hwnd, LONG idObject, LONG idItem, PMENUBARINFO
}
else if (idItem == 0)
{
GetMenuItemRect(hwnd, hmenu, 0, &pmbi->rcBar);
NtUserGetMenuItemRect( hwnd, hmenu, 0, &pmbi->rcBar );
pmbi->rcBar.right = pmbi->rcBar.left + menu->Width;
pmbi->rcBar.bottom = pmbi->rcBar.top + menu->Height;
}
else
{
GetMenuItemRect(hwnd, hmenu, idItem - 1, &pmbi->rcBar);
NtUserGetMenuItemRect( hwnd, hmenu, idItem - 1, &pmbi->rcBar );
}
pmbi->hMenu = hmenu;
@ -5120,51 +5120,6 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu, UINT first, UINT last,
}
/**********************************************************************
* GetMenuItemRect (USER32.@)
*
* ATTENTION: Here, the returned values in rect are the screen
* coordinates of the item just like if the menu was
* always on the upper left side of the application.
*
*/
BOOL WINAPI GetMenuItemRect(HWND hwnd, HMENU hMenu, UINT uItem, RECT *rect)
{
POPUPMENU *menu;
UINT pos;
RECT window_rect;
TRACE("(%p,%p,%d,%p)\n", hwnd, hMenu, uItem, rect);
if (!rect)
return FALSE;
if (!(menu = find_menu_item(hMenu, uItem, MF_BYPOSITION, &pos)))
return FALSE;
if (!hwnd) hwnd = menu->hWnd;
if (!hwnd)
{
release_menu_ptr(menu);
return FALSE;
}
*rect = menu->items[pos].rect;
OffsetRect(rect, menu->items_rect.left, menu->items_rect.top);
/* Popup menu item draws in the client area */
if (menu->wFlags & MF_POPUP) MapWindowPoints(hwnd, 0, (POINT *)rect, 2);
else
{
/* Sysmenu draws in the non-client area */
GetWindowRect(hwnd, &window_rect);
OffsetRect(rect, window_rect.left, window_rect.top);
}
release_menu_ptr(menu);
return TRUE;
}
/**********************************************************************
* SetMenuInfo (USER32.@)
*

View File

@ -338,7 +338,7 @@
@ stdcall GetMenuItemID(long long)
@ stdcall GetMenuItemInfoA(long long long ptr)
@ stdcall GetMenuItemInfoW(long long long ptr)
@ stdcall GetMenuItemRect(long long long ptr)
@ stdcall GetMenuItemRect(long long long ptr) NtUserGetMenuItemRect
@ stdcall GetMenuState(long long long)
@ stdcall GetMenuStringA(long long ptr long long)
@ stdcall GetMenuStringW(long long ptr long long)

View File

@ -348,6 +348,46 @@ BOOL draw_menu_bar( HWND hwnd )
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
}
/**********************************************************************
* NtUserGetMenuItemRect (win32u.@)
*/
BOOL WINAPI NtUserGetMenuItemRect( HWND hwnd, HMENU handle, UINT item, RECT *rect )
{
POPUPMENU *menu;
UINT pos;
RECT window_rect;
TRACE( "(%p,%p,%d,%p)\n", hwnd, handle, item, rect );
if (!rect)
return FALSE;
if (!(menu = find_menu_item( handle, item, MF_BYPOSITION, &pos )))
return FALSE;
if (!hwnd) hwnd = menu->hWnd;
if (!hwnd)
{
release_menu_ptr( menu );
return FALSE;
}
*rect = menu->items[pos].rect;
OffsetRect( rect, menu->items_rect.left, menu->items_rect.top );
/* Popup menu item draws in the client area */
if (menu->wFlags & MF_POPUP) map_window_points( hwnd, 0, (POINT *)rect, 2, get_thread_dpi() );
else
{
/* Sysmenu draws in the non-client area */
get_window_rect( hwnd, &window_rect, get_thread_dpi() );
OffsetRect( rect, window_rect.left, window_rect.top );
}
release_menu_ptr(menu);
return TRUE;
}
/**********************************************************************
* NtUserSetMenuContextHelpId (win32u.@)
*/

View File

@ -136,6 +136,7 @@ static void * const syscalls[] =
NtUserGetKeyboardLayoutName,
NtUserGetKeyboardState,
NtUserGetLayeredWindowAttributes,
NtUserGetMenuItemRect,
NtUserGetMouseMovePointsEx,
NtUserGetObjectInformation,
NtUserGetOpenClipboardWindow,

View File

@ -954,7 +954,7 @@
@ stub NtUserGetListBoxInfo
@ stub NtUserGetMenuBarInfo
@ stub NtUserGetMenuIndex
@ stub NtUserGetMenuItemRect
@ stdcall -syscall NtUserGetMenuItemRect(long long long ptr)
@ stdcall NtUserGetMessage(ptr long long long)
@ stdcall -syscall NtUserGetMouseMovePointsEx(long ptr ptr long long)
@ stdcall -syscall NtUserGetObjectInformation(long long long long ptr)

View File

@ -123,6 +123,7 @@
SYSCALL_ENTRY( NtUserGetKeyboardLayoutName ) \
SYSCALL_ENTRY( NtUserGetKeyboardState ) \
SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
SYSCALL_ENTRY( NtUserGetMenuItemRect ) \
SYSCALL_ENTRY( NtUserGetMouseMovePointsEx ) \
SYSCALL_ENTRY( NtUserGetObjectInformation ) \
SYSCALL_ENTRY( NtUserGetOpenClipboardWindow ) \

View File

@ -642,6 +642,16 @@ NTSTATUS WINAPI wow64_NtUserCheckMenuItem( UINT *args )
return NtUserCheckMenuItem( handle, id, flags );
}
NTSTATUS WINAPI wow64_NtUserGetMenuItemRect( UINT *args )
{
HWND hwnd = get_handle( &args );
HMENU handle = get_handle( &args );
UINT item = get_ulong( &args );
RECT *rect = get_ptr( &args );
return NtUserGetMenuItemRect( hwnd, handle, item, rect );
}
NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args )
{
HMENU menu = get_handle( &args );

View File

@ -492,6 +492,7 @@ UINT WINAPI NtUserGetKeyboardLayoutList( INT size, HKL *layouts );
BOOL WINAPI NtUserGetKeyboardLayoutName( WCHAR *name );
BOOL WINAPI NtUserGetKeyboardState( BYTE *state );
BOOL WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags );
BOOL WINAPI NtUserGetMenuItemRect( HWND hwnd, HMENU menu, UINT item, RECT *rect );
BOOL WINAPI NtUserGetMessage( MSG *msg, HWND hwnd, UINT first, UINT last );
int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOVEPOINT *ptout,
int count, DWORD resolution );