Huw Davies : user32: Simplify GetMenuItemRect().
Alexandre Julliard
julliard at winehq.org
Tue Mar 28 15:38:42 CDT 2017
Module: wine
Branch: master
Commit: d4d0247f4e3f4ddbcc7857d8c279e45b1107070b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4d0247f4e3f4ddbcc7857d8c279e45b1107070b
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Mar 28 12:52:20 2017 +0100
user32: Simplify GetMenuItemRect().
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/menu.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 6584a41..3c1bb3e 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 ((rect == NULL) || (item == NULL))
+ return FALSE;
- if(itemMenu->hWnd == 0)
- return FALSE;
- referenceHwnd = itemMenu->hWnd;
- }
+ menu = MENU_GetMenu(hMenu);
+ if (!menu) return FALSE;
- if ((rect == NULL) || (item == NULL))
- 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;
}
More information about the wine-cvs
mailing list