Author: jimtabor
Date: Tue Mar 18 01:15:08 2014
New Revision: 62526
URL:
http://svn.reactos.org/svn/reactos?rev=62526&view=rev
Log:
[NtUser|User32]
- Use new menu flags.
- Fix msg test_menu_messages tests. Patch from CORE-7966 breaks it.
- Fix edit tests with GetMenuBarInfo.
- Fix menu test_getmenubarinfo tests but the todo on line 375.
Modified:
trunk/reactos/win32ss/user/ntuser/menu.c
trunk/reactos/win32ss/user/user32/windows/menu.c
Modified: trunk/reactos/win32ss/user/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Tue Mar 18 01:15:08 2014
@@ -271,7 +271,7 @@
Menu->MenuInfo.dwMenuData = 0; /* Default */
Menu->MenuInfo.Self = *Handle;
Menu->MenuInfo.FocusedItem = NO_SELECTED_ITEM;
- Menu->MenuInfo.Flags = (IsMenuBar ? 0 : MF_POPUP);
+ Menu->MenuInfo.Flags = (IsMenuBar ? 0 : MNF_POPUP);
Menu->MenuInfo.Wnd = NULL;
Menu->MenuInfo.WndOwner = NULL;
Menu->MenuInfo.Height = 0;
@@ -741,7 +741,7 @@
SubMenuObject = UserGetMenuObject(MenuItem->hSubMenu);
if (SubMenuObject != NULL)
{
- SubMenuObject->MenuInfo.Flags |= MF_POPUP;
+ SubMenuObject->MenuInfo.Flags |= MNF_POPUP;
MenuItem->fType |= MF_POPUP;
}
else
@@ -784,7 +784,7 @@
}
else
{
- if (0 == (MenuObject->MenuInfo.Flags & MF_SYSMENU))
+ if (0 == (MenuObject->MenuInfo.Flags & MNF_SYSDESKMN))
{
MenuItem->fType |= MF_SEPARATOR;
}
@@ -1733,6 +1733,50 @@
END_CLEANUP;
}
+BOOL FASTCALL
+IntGetMenuItemRect(
+ PWND pWnd,
+ PMENU_OBJECT Menu,
+ UINT uItem,
+ PRECTL Rect)
+{
+ LONG XMove, YMove;
+ PMENU_ITEM MenuItem;
+ int p = 0;
+
+ if (!pWnd)
+ {
+ HWND hWnd = Menu->MenuInfo.Wnd;
+ if (!(pWnd = UserGetWindowObject(hWnd))) return FALSE;
+ }
+
+ if ((p = IntGetMenuItemByFlag(Menu, uItem, MF_BYPOSITION, NULL, &MenuItem, NULL))
> -1)
+ *Rect = MenuItem->Rect;
+ else
+ {
+ ERR("Failed Item Lookup! %d\n", p);
+ return FALSE;
+ }
+
+ if (Menu->MenuInfo.Flags & MNF_POPUP)
+ {
+ XMove = pWnd->rcClient.left;
+ YMove = pWnd->rcClient.top;
+ }
+ else
+ {
+ XMove = pWnd->rcWindow.left;
+ YMove = pWnd->rcWindow.top;
+ }
+
+ Rect->left += XMove;
+ Rect->top += YMove;
+ Rect->right += XMove;
+ Rect->bottom += YMove;
+
+ return TRUE;
+}
+
/*
* @implemented
*/
@@ -1743,219 +1787,126 @@
LONG idItem,
PMENUBARINFO pmbi)
{
- BOOL Res = TRUE;
- PMENU_OBJECT MenuObject;
- PMENU_ITEM mi;
- PWND WindowObject;
+ PWND pWnd;
HMENU hMenu;
- POINT Offset;
- RECTL Rect;
MENUBARINFO kmbi;
+ BOOL Ret;
+ NTSTATUS Status = STATUS_SUCCESS;
+ PMENU_OBJECT Menu = NULL;
DECLARE_RETURN(BOOL);
TRACE("Enter NtUserGetMenuBarInfo\n");
UserEnterShared();
- if (!(WindowObject = UserGetWindowObject(hwnd)))
- {
+ if (!(pWnd = UserGetWindowObject(hwnd)))
+ {
EngSetLastError(ERROR_INVALID_WINDOW_HANDLE);
RETURN(FALSE);
- }
-
- hMenu = (HMENU)(DWORD_PTR)WindowObject->IDMenu;
-
- if (!(MenuObject = UserGetMenuObject(hMenu)))
- {
- EngSetLastError(ERROR_INVALID_MENU_HANDLE);
- RETURN(FALSE);
- }
-
- if (pmbi->cbSize != sizeof(MENUBARINFO))
- {
+ }
+
+ switch (idObject)
+ {
+ case OBJID_CLIENT:
+ if (!pWnd->pcls->fnid)
+ RETURN(FALSE);
+ if (pWnd->pcls->fnid != FNID_MENU)
+ {
+ WARN("called on invalid window: %d\n", pWnd->pcls->fnid);
+ EngSetLastError(ERROR_INVALID_MENU_HANDLE);
+ RETURN(FALSE);
+ }
+ // Windows does this! Wine checks for Atom and uses GetWindowLongPtrW.
+ hMenu = (HMENU)co_IntSendMessage(hwnd, MN_GETHMENU, 0, 0);
+ break;
+ case OBJID_MENU:
+ hMenu = UlongToHandle(pWnd->IDMenu);
+ break;
+ case OBJID_SYSMENU:
+ if (!(pWnd->style & WS_SYSMENU)) RETURN(FALSE);
+ Menu = IntGetSystemMenu(pWnd, FALSE, FALSE);
+ hMenu = Menu->MenuInfo.Self;
+ break;
+ default:
+ RETURN(FALSE);
+ }
+
+ if (!hMenu)
+ RETURN(FALSE);
+
+ _SEH2_TRY
+ {
+ kmbi.cbSize = pmbi->cbSize;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ kmbi.cbSize = 0;
+ }
+ _SEH2_END
+
+ if (kmbi.cbSize != sizeof(MENUBARINFO))
+ {
EngSetLastError(ERROR_INVALID_PARAMETER);
RETURN(FALSE);
- }
-
- kmbi.cbSize = sizeof(MENUBARINFO);
- kmbi.fBarFocused = FALSE;
- kmbi.fFocused = FALSE;
+ }
+
+ if (!Menu) Menu = UserGetMenuObject(hMenu);
+ if (!Menu)
+ RETURN(FALSE);
+
+ if (idItem < 0 || idItem > Menu->MenuInfo.MenuItemCount)
+ RETURN(FALSE);
+
+ RECTL_vSetEmptyRect(&kmbi.rcBar);
+
+ if (idItem == 0)
+ {
+ Ret = IntGetMenuItemRect(pWnd, Menu, -1, &kmbi.rcBar);
+ kmbi.rcBar.right = kmbi.rcBar.left + Menu->MenuInfo.Width;
+ kmbi.rcBar.bottom = kmbi.rcBar.top + Menu->MenuInfo.Height;
+ ERR("idItem 0 %d\n",Ret);
+ }
+ else
+ {
+ Ret = IntGetMenuItemRect(pWnd, Menu, idItem-1, &kmbi.rcBar);
+ ERR("idItem X %d\n", Ret);
+ }
+
+ kmbi.hMenu = hMenu;
kmbi.hwndMenu = NULL;
-
- switch (idObject)
- {
- case OBJID_MENU:
- {
- PMENU_OBJECT SubMenuObject;
- kmbi.hMenu = hMenu;
- if (idItem) /* Non-Zero-Based. */
- {
- if (IntGetMenuItemByFlag(MenuObject, idItem-1, MF_BYPOSITION, NULL,
&mi, NULL) > -1)
- kmbi.rcBar = mi->Rect;
- else
- {
- Res = FALSE;
- break;
- }
- }
- else
- {
- /* If items is zero we assume info for the menu itself. */
- if (!(IntGetClientOrigin(WindowObject, &Offset)))
- {
- Res = FALSE;
- break;
- }
- Rect.left = Offset.x;
- Rect.right = Offset.x + MenuObject->MenuInfo.Width;
- Rect.bottom = Offset.y;
- Rect.top = Offset.y - MenuObject->MenuInfo.Height;
- kmbi.rcBar = Rect;
- TRACE("Rect top = %d bottom = %d left = %d right = %d \n",
- Rect.top, Rect.bottom, Rect.left, Rect.right);
- }
- if (idItem)
- {
- if (idItem-1 == MenuObject->MenuInfo.FocusedItem)
- kmbi.fFocused = TRUE;
- }
- if (MenuObject->MenuInfo.FocusedItem != NO_SELECTED_ITEM)
- kmbi.fBarFocused = TRUE;
-
- if (MenuObject->MenuItemList)
- {
- SubMenuObject = UserGetMenuObject(MenuObject->MenuItemList->hSubMenu);
- if(SubMenuObject) kmbi.hwndMenu = SubMenuObject->MenuInfo.Wnd;
- }
- TRACE("OBJID_MENU, idItem = %d\n",idItem);
- break;
- }
- case OBJID_CLIENT:
- {
- PMENU_OBJECT SubMenuObject, XSubMenuObject;
- HMENU hMenuChk;
- // Windows does this! Wine checks for Atom and uses GetWindowLongPtrW.
- hMenuChk = (HMENU)co_IntSendMessage(hwnd, MN_GETHMENU, 0, 0);
-
- if (!(MenuObject = UserGetMenuObject(hMenuChk)))
- {
- ERR("Window does not have a Popup Menu!\n");
- EngSetLastError(ERROR_INVALID_MENU_HANDLE);
- RETURN(FALSE);
- }
-
- SubMenuObject = UserGetMenuObject(MenuObject->MenuItemList->hSubMenu);
- if(SubMenuObject) kmbi.hMenu = SubMenuObject->MenuInfo.Self;
- else
- {
- Res = FALSE;
- ERR("OBJID_CLIENT, No SubMenu!\n");
- break;
- }
- if (idItem)
- {
- if (IntGetMenuItemByFlag(SubMenuObject, idItem-1, MF_BYPOSITION, NULL,
&mi, NULL) > -1)
- kmbi.rcBar = mi->Rect;
- else
- {
- Res = FALSE;
- break;
- }
- }
- else
- {
- PWND SubWinObj;
- if (!(SubWinObj = UserGetWindowObject(SubMenuObject->MenuInfo.Wnd)))
- {
- Res = FALSE;
- break;
- }
- if (!(IntGetClientOrigin(SubWinObj, &Offset)))
- {
- Res = FALSE;
- break;
- }
- Rect.left = Offset.x;
- Rect.right = Offset.x + SubMenuObject->MenuInfo.Width;
- Rect.top = Offset.y;
- Rect.bottom = Offset.y + SubMenuObject->MenuInfo.Height;
- kmbi.rcBar = Rect;
- }
- if (idItem)
- {
- if (idItem-1 == SubMenuObject->MenuInfo.FocusedItem)
- kmbi.fFocused = TRUE;
- }
- if (SubMenuObject->MenuInfo.FocusedItem != NO_SELECTED_ITEM)
- kmbi.fBarFocused = TRUE;
- XSubMenuObject =
UserGetMenuObject(SubMenuObject->MenuItemList->hSubMenu);
- if (XSubMenuObject) kmbi.hwndMenu = XSubMenuObject->MenuInfo.Wnd;
- TRACE("OBJID_CLIENT, idItem = %d\n",idItem);
- break;
- }
- case OBJID_SYSMENU:
- {
- PMENU_OBJECT SysMenuObject, SubMenuObject;
- if(!(SysMenuObject = IntGetSystemMenu(WindowObject, FALSE, FALSE)))
- {
- Res = FALSE;
- break;
- }
- kmbi.hMenu = SysMenuObject->MenuInfo.Self;
- if (idItem)
- {
- if (IntGetMenuItemByFlag(SysMenuObject, idItem-1, MF_BYPOSITION, NULL,
&mi, NULL) > -1)
- kmbi.rcBar = mi->Rect;
- else
- {
- Res = FALSE;
- break;
- }
- }
- else
- {
- PWND SysWinObj;
- if (!(SysWinObj = UserGetWindowObject(SysMenuObject->MenuInfo.Wnd)))
- {
- Res = FALSE;
- break;
- }
- if (!(IntGetClientOrigin(SysWinObj, &Offset)))
- {
- Res = FALSE;
- break;
- }
- Rect.left = Offset.x;
- Rect.right = Offset.x + SysMenuObject->MenuInfo.Width;
- Rect.top = Offset.y;
- Rect.bottom = Offset.y + SysMenuObject->MenuInfo.Height;
- kmbi.rcBar = Rect;
- }
- if (idItem)
- {
- if (idItem-1 == SysMenuObject->MenuInfo.FocusedItem)
- kmbi.fFocused = TRUE;
- }
- if (SysMenuObject->MenuInfo.FocusedItem != NO_SELECTED_ITEM)
- kmbi.fBarFocused = TRUE;
- SubMenuObject = UserGetMenuObject(SysMenuObject->MenuItemList->hSubMenu);
- if(SubMenuObject) kmbi.hwndMenu = SubMenuObject->MenuInfo.Wnd;
- TRACE("OBJID_SYSMENU, idItem = %d\n",idItem);
- break;
- }
- default:
- Res = FALSE;
- ERR("Unknown idObject = %d, idItem = %d\n",idObject,idItem);
- }
- if (Res)
- {
- NTSTATUS Status = MmCopyToCaller(pmbi, &kmbi, sizeof(MENUBARINFO));
- if (! NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- RETURN(FALSE);
- }
- }
- RETURN(Res);
+ //kmbi.fBarFocused = top_popup_hmenu == hMenu;
+ if (idItem)
+ {
+ PMENU_OBJECT SubMenuObject;
+ kmbi.fFocused = Menu->MenuInfo.FocusedItem == idItem-1;
+
+ if ( kmbi.fFocused && Menu->MenuItemList->hSubMenu )
+ {
+ SubMenuObject = UserGetMenuObject(Menu->MenuItemList->hSubMenu);
+ if (SubMenuObject) kmbi.hwndMenu = SubMenuObject->MenuInfo.Wnd;
+ }
+ }
+/* else
+ {
+ kmbi.fFocused = kmbi.fBarFocused;
+ }
+*/
+ _SEH2_TRY
+ {
+ RtlCopyMemory(pmbi, &kmbi, sizeof(MENUBARINFO));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END
+
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ RETURN(FALSE);
+ }
+
+ RETURN(TRUE);
CLEANUP:
TRACE("Leave NtUserGetMenuBarInfo, ret=%i\n",_ret_);
@@ -2011,9 +1962,9 @@
PWND ReferenceWnd;
LONG XMove, YMove;
RECTL Rect;
- NTSTATUS Status;
PMENU_OBJECT Menu;
PMENU_ITEM MenuItem;
+ NTSTATUS Status = STATUS_SUCCESS;
DECLARE_RETURN(BOOL);
TRACE("Enter NtUserGetMenuItemRect\n");
@@ -2038,7 +1989,7 @@
if (!(ReferenceWnd = UserGetWindowObject(hWnd))) RETURN( FALSE);
- if(MenuItem->fType & MF_POPUP)
+ if (Menu->MenuInfo.Flags & MNF_POPUP)
{
XMove = ReferenceWnd->rcClient.left;
YMove = ReferenceWnd->rcClient.top;
@@ -2054,13 +2005,22 @@
Rect.right += XMove;
Rect.bottom += YMove;
- Status = MmCopyToCaller(lprcItem, &Rect, sizeof(RECT));
- if (! NT_SUCCESS(Status))
+ _SEH2_TRY
+ {
+ RtlCopyMemory(lprcItem, &Rect, sizeof(RECTL));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END
+
+ if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
- RETURN( FALSE);
- }
- RETURN( TRUE);
+ RETURN(FALSE);
+ }
+ RETURN(TRUE);
CLEANUP:
TRACE("Leave NtUserGetMenuItemRect, ret=%i\n",_ret_);
Modified: trunk/reactos/win32ss/user/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] Tue Mar 18 01:15:08
2014
@@ -46,10 +46,10 @@
#define IS_MAGIC_BITMAP(id) ((id) && ((INT_PTR)(id) < 12) &&
((INT_PTR)(id) >= -1))
#define IS_SYSTEM_MENU(MenuInfo) \
- (0 == ((MenuInfo)->Flags & MF_POPUP) && 0 != ((MenuInfo)->Flags &
MF_SYSMENU))
+ (0 == ((MenuInfo)->Flags & MNF_POPUP) && 0 != ((MenuInfo)->Flags &
MNF_SYSDESKMN))
#define IS_SYSTEM_POPUP(MenuInfo) \
- (0 != ((MenuInfo)->Flags & MF_POPUP) && 0 != ((MenuInfo)->Flags &
MF_SYSMENU))
+ (0 != ((MenuInfo)->Flags & MNF_POPUP) && 0 != ((MenuInfo)->Flags &
MNF_SYSDESKMN))
#define IS_BITMAP_ITEM(flags) (MF_BITMAP == MENU_ITEM_TYPE(flags))
@@ -507,6 +507,7 @@
PROSMENUITEMINFO Items, ItemInfo;
LRESULT MenuChar;
UINT i;
+ WORD Flags = 0;
TRACE("\tlooking for '%c' (0x%02x) in [%p]\n", (char) Key, Key,
MenuInfo);
@@ -546,8 +547,11 @@
}
}
+ Flags |= MenuInfo->Flags & MNF_POPUP ? MF_POPUP : 0;
+ Flags |= MenuInfo->Flags & MNF_SYSDESKMN ? MF_SYSMENU : 0;
+
MenuChar = SendMessageW(WndOwner, WM_MENUCHAR,
- MAKEWPARAM(Key, MenuInfo->Flags), (LPARAM)
MenuInfo->Self);
+ MAKEWPARAM(Key, Flags), (LPARAM) MenuInfo->Self);
if (HIWORD(MenuChar) == MNC_EXECUTE) return LOWORD(MenuChar);
if (HIWORD(MenuChar) == MNC_CLOSE) return (UINT)(-2);
}
@@ -1650,7 +1654,7 @@
if (!hmenu || !hmenu->MenuItemCount || !hmenu->Wnd) return;
if (hmenu->FocusedItem == wIndex) return;
- if (hmenu->Flags & MF_POPUP) hdc = GetDC(hmenu->Wnd);
+ if (hmenu->Flags & MNF_POPUP) hdc = GetDC(hmenu->Wnd);
else hdc = GetDCEx(hmenu->Wnd, 0, DCX_CACHE | DCX_WINDOW);
if (!top_popup) {
top_popup = hmenu->Wnd;
@@ -1671,7 +1675,7 @@
MenuSetRosMenuItemInfo(hmenu->Self, hmenu->FocusedItem,
&ItemInfo);
}
MenuDrawMenuItem(hmenu->Wnd, hmenu, hwndOwner, hdc, &ItemInfo,
- hmenu->Height, ! (hmenu->Flags & MF_POPUP),
+ hmenu->Height, !(hmenu->Flags & MNF_POPUP),
ODA_SELECT);
}
@@ -1688,15 +1692,16 @@
ItemInfo.fState |= MF_HILITE;
MenuSetRosMenuItemInfo(hmenu->Self, hmenu->FocusedItem,
&ItemInfo);
MenuDrawMenuItem(hmenu->Wnd, hmenu, hwndOwner, hdc,
- &ItemInfo, hmenu->Height, ! (hmenu->Flags &
MF_POPUP),
+ &ItemInfo, hmenu->Height, !(hmenu->Flags &
MNF_POPUP),
ODA_SELECT);
}
if (sendMenuSelect)
{
- SendMessageW(hwndOwner, WM_MENUSELECT,
- MAKELONG(ItemInfo.fType & MF_POPUP ? wIndex :
ItemInfo.wID,
- ItemInfo.fType | ItemInfo.fState | MF_MOUSESELECT |
- (hmenu->Flags & MF_SYSMENU)), (LPARAM)
hmenu->Self);
+ WPARAM wParam = MAKELONG( ItemInfo.fType & MF_POPUP ? wIndex :
ItemInfo.wID,
+ ItemInfo.fType | ItemInfo.fState |
+ (hmenu->Flags & MNF_SYSDESKMN ?
MF_SYSMENU : 0 ) );
+
+ SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) hmenu->Self);
}
}
}
@@ -1709,11 +1714,10 @@
if (MenuGetRosMenuInfo(&TopMenuInfo, topmenu)
&& MenuGetRosMenuItemInfo(topmenu, pos, &ItemInfo))
{
- SendMessageW(hwndOwner, WM_MENUSELECT,
- MAKELONG(Pos, ItemInfo.fType | ItemInfo.fState
- | MF_MOUSESELECT
- | (TopMenuInfo.Flags & MF_SYSMENU)),
- (LPARAM) topmenu);
+ WPARAM wParam = MAKELONG( Pos, ItemInfo.fType | ItemInfo.fState |
+ (TopMenuInfo.Flags & MNF_SYSDESKMN ?
MF_SYSMENU : 0 ) );
+
+ SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) topmenu);
}
}
}
@@ -2341,7 +2345,7 @@
/* correct item if modified as a reaction to WM_INITMENUPOPUP message */
if (0 == (ItemInfo.fState & MF_HILITE))
{
- if (0 != (MenuInfo->Flags & MF_POPUP))
+ if (0 != (MenuInfo->Flags & MNF_POPUP))
{
Dc = GetDC(MenuInfo->Wnd);
}
@@ -2355,7 +2359,7 @@
ItemInfo.fState |= MF_HILITE;
MenuSetRosMenuItemInfo(MenuInfo->Self, MenuInfo->FocusedItem,
&ItemInfo);
MenuDrawMenuItem(MenuInfo->Wnd, MenuInfo, WndOwner, Dc, &ItemInfo,
MenuInfo->Height,
- ! (MenuInfo->Flags & MF_POPUP), ODA_DRAWENTIRE);
+ ! (MenuInfo->Flags & MNF_POPUP), ODA_DRAWENTIRE);
ReleaseDC(MenuInfo->Wnd, Dc);
}
@@ -2382,7 +2386,7 @@
else
{
GetWindowRect(MenuInfo->Wnd, &Rect);
- if (0 != (MenuInfo->Flags & MF_POPUP))
+ if (0 != (MenuInfo->Flags & MNF_POPUP))
{
Rect.left += ItemInfo.Rect.right - GetSystemMetrics(SM_CXBORDER);
Rect.top += ItemInfo.Rect.top - 3;
@@ -2485,7 +2489,7 @@
if (MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu) &&
Mt->TopMenu != PtMenuInfo->Self &&
- 0 == ((PtMenuInfo->Flags | TopMenuInfo.Flags) & MF_POPUP))
+ 0 == ((PtMenuInfo->Flags | TopMenuInfo.Flags) & MNF_POPUP))
{
/* both are top level menus (system and menu-bar) */
MenuHideSubPopups(Mt->OwnerWnd, &TopMenuInfo, FALSE, wFlags);
@@ -2541,17 +2545,20 @@
do not send a message to the owner */
if (0 == (Flags & TPM_RETURNCMD))
{
- if (0 != (MenuInfo->Flags & MF_SYSMENU))
+ if (0 != (MenuInfo->Flags & MNF_SYSDESKMN))
{
PostMessageW(Mt->OwnerWnd, WM_SYSCOMMAND, ItemInfo.wID,
MAKELPARAM((SHORT) Mt->Pt.x, (SHORT) Mt->Pt.y));
}
else
{
- if (MenuInfo->dwStyle & MNS_NOTIFYBYPOS)
- PostMessageW(Mt->OwnerWnd, WM_MENUCOMMAND,
- MenuInfo->FocusedItem,
- (LPARAM)MenuInfo->Self);
+ BOOL ret;
+ ROSMENUINFO topmenuI;
+ ret = MenuGetRosMenuInfo(&topmenuI, Mt->TopMenu);
+ DWORD dwStyle = MenuInfo->dwStyle | (ret ? topmenuI.dwStyle : 0);
+
+ if (dwStyle & MNS_NOTIFYBYPOS)
+ PostMessageW(Mt->OwnerWnd, WM_MENUCOMMAND,
MenuInfo->FocusedItem, (LPARAM)MenuInfo->Self);
else
PostMessageW(Mt->OwnerWnd, WM_COMMAND, ItemInfo.wID, 0);
}
@@ -2727,7 +2734,7 @@
/* check the current window (avoiding WM_HITTEST) */
Ht = DefWndNCHitTest(MenuInfo.Wnd, Pt);
- if (0 != (MenuInfo.Flags & MF_POPUP))
+ if (0 != (MenuInfo.Flags & MNF_POPUP))
{
if (HTNOWHERE != Ht && HTERROR != Ht)
{
@@ -3013,7 +3020,7 @@
if (Mt->CurrentMenu != Mt->TopMenu)
{
if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu)
- && 0 != (MenuInfo.Flags & MF_POPUP))
+ && 0 != (MenuInfo.Flags & MNF_POPUP))
{
MenuPrev = MenuTmp = Mt->TopMenu;
@@ -3085,7 +3092,7 @@
{
return;
}
- if ((MenuPrev == Mt->TopMenu) && !(TopMenuInfo.Flags & MF_POPUP))
+ if ((MenuPrev == Mt->TopMenu) && !(TopMenuInfo.Flags & MNF_POPUP))
{
/* move menu bar selection if no more popups are left */
@@ -3125,7 +3132,7 @@
Mt->CurrentMenu, Mt->TopMenu);
if (! MenuGetRosMenuInfo(&MenuInfo, Mt->TopMenu)) return;
- if ((MenuInfo.Flags & MF_POPUP) || (Mt->CurrentMenu != Mt->TopMenu))
+ if ((MenuInfo.Flags & MNF_POPUP) || (Mt->CurrentMenu != Mt->TopMenu))
{
/* If already displaying a popup, try to display sub-popup */
@@ -3155,7 +3162,7 @@
return;
}
- if (!(MenuInfo.Flags & MF_POPUP)) /* menu bar tracking */
+ if (!(MenuInfo.Flags & MNF_POPUP)) /* menu bar tracking */
{
if (Mt->CurrentMenu != Mt->TopMenu)
{
@@ -3266,7 +3273,7 @@
}
if (!enterIdleSent)
{
- HWND win = MenuInfo.Flags & MF_POPUP ? MenuInfo.Wnd : NULL;
+ HWND win = MenuInfo.Flags & MNF_POPUP ? MenuInfo.Wnd : NULL;
enterIdleSent = TRUE;
SendMessageW( mt.OwnerWnd, WM_ENTERIDLE, MSGF_MENU, (LPARAM) win);
}
@@ -3385,7 +3392,7 @@
case VK_DOWN: /* If on menu bar, pull-down the menu */
if (MenuGetRosMenuInfo(&MenuInfo, mt.CurrentMenu))
{
- if (!(MenuInfo.Flags & MF_POPUP))
+ if (!(MenuInfo.Flags & MNF_POPUP))
{
if (MenuGetRosMenuInfo(&MenuInfo, mt.TopMenu))
mt.CurrentMenu = MenuShowSubPopup(mt.OwnerWnd,
&MenuInfo, TRUE, wFlags);
@@ -3508,16 +3515,15 @@
{
MenuHideSubPopups(mt.OwnerWnd, &MenuInfo, FALSE, wFlags);
- if (MenuInfo.Flags & MF_POPUP)
+ if (MenuInfo.Flags & MNF_POPUP)
{
IntNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, MenuInfo.Wnd,
OBJID_CLIENT, CHILDID_SELF, 0);
DestroyWindow(MenuInfo.Wnd);
MenuInfo.Wnd = NULL;
- if (!(MenuInfo.Flags & TPM_NONOTIFY))
+ if (!(wFlags & TPM_NONOTIFY))
SendMessageW( mt.OwnerWnd, WM_UNINITMENUPOPUP, (WPARAM)mt.TopMenu,
MAKELPARAM(0, IS_SYSTEM_MENU(&MenuInfo)) );
-
}
MenuSelectItem( mt.OwnerWnd, &MenuInfo, NO_SELECTED_ITEM, FALSE, 0
);
}
@@ -3585,7 +3591,7 @@
IntNotifyWinEvent( EVENT_SYSTEM_MENUSTART,
hWnd,
- MenuInfo.Flags & MF_SYSMENU ? OBJID_SYSMENU : OBJID_MENU,
+ MenuInfo.Flags & MNF_SYSDESKMN ? OBJID_SYSMENU : OBJID_MENU,
CHILDID_SELF, 0);
return TRUE;
}