From d4d0247f4e3f4ddbcc7857d8c279e45b1107070b Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 28 Mar 2017 12:52:20 +0100 Subject: [PATCH] user32: Simplify GetMenuItemRect(). Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/menu.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 6584a41f4b4..3c1bb3e7f91 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -5105,35 +5105,26 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu, * always on the upper left side of the application. * */ -BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem, - LPRECT rect) +BOOL WINAPI GetMenuItemRect(HWND hwnd, HMENU hMenu, UINT uItem, RECT *rect) { - POPUPMENU *itemMenu; + POPUPMENU *menu; MENUITEM *item; - HWND referenceHwnd; TRACE("(%p,%p,%d,%p)\n", hwnd, hMenu, uItem, rect); item = MENU_FindItem (&hMenu, &uItem, MF_BYPOSITION); - referenceHwnd = hwnd; - - if(!hwnd) - { - itemMenu = MENU_GetMenu(hMenu); - if (itemMenu == NULL) - return FALSE; - - if(itemMenu->hWnd == 0) - return FALSE; - referenceHwnd = itemMenu->hWnd; - } - if ((rect == NULL) || (item == NULL)) - return FALSE; + return FALSE; + + menu = MENU_GetMenu(hMenu); + if (!menu) return FALSE; + + if (!hwnd) hwnd = menu->hWnd; + if (!hwnd) return FALSE; *rect = item->rect; - MapWindowPoints(referenceHwnd, 0, (LPPOINT)rect, 2); + MapWindowPoints(hwnd, 0, (POINT *)rect, 2); return TRUE; }