Author: dquintana
Date: Mon Mar 3 16:12:39 2014
New Revision: 62415
URL:
http://svn.reactos.org/svn/reactos?rev=62415&view=rev
Log:
[NTUSER]
[USER32]
* Fix what I think is a wrong behaviour of storing MF_POPUP in the fType of the menu. Now
it relies on hSubMenu being != NULL as an indicator of the presence of a submenu.
* Resource submenus are not supposed to get the hSubMenu as a wID, as far as I can tell.
* From the user point of view, it matches Windows better. Needs review and testing, as I
don't know if I updated everything correctly.
Modified:
branches/shell-experiments/win32ss/user/ntuser/menu.c
branches/shell-experiments/win32ss/user/user32/windows/menu.c
Modified: branches/shell-experiments/win32ss/user/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/win32ss/user/…
==============================================================================
--- branches/shell-experiments/win32ss/user/ntuser/menu.c [iso-8859-1] (original)
+++ branches/shell-experiments/win32ss/user/ntuser/menu.c [iso-8859-1] Mon Mar 3 16:12:39
2014
@@ -529,7 +529,7 @@
}
else
{
- if(CurItem->fType & MF_POPUP)
+ if(CurItem->hSubMenu)
{
PMENU_OBJECT NewMenu = UserGetMenuObject(CurItem->hSubMenu);
if(NewMenu)
@@ -653,8 +653,7 @@
BOOL FASTCALL
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, PROSMENUITEMINFO lpmii)
{
- PMENU_OBJECT SubMenuObject;
- UINT fTypeMask = (MFT_BITMAP | MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_OWNERDRAW |
MFT_RADIOCHECK | MFT_RIGHTJUSTIFY | MFT_SEPARATOR | MF_POPUP);
+ UINT fTypeMask = (MFT_BITMAP | MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_OWNERDRAW |
MFT_RADIOCHECK | MFT_RIGHTJUSTIFY | MFT_SEPARATOR);
if(!MenuItem || !MenuObject || !lpmii)
{
@@ -735,24 +734,6 @@
if(lpmii->fMask & MIIM_SUBMENU)
{
MenuItem->hSubMenu = lpmii->hSubMenu;
- /* Make sure the submenu is marked as a popup menu */
- if (MenuItem->hSubMenu)
- {
- SubMenuObject = UserGetMenuObject(MenuItem->hSubMenu);
- if (SubMenuObject != NULL)
- {
- SubMenuObject->MenuInfo.Flags |= MF_POPUP;
- MenuItem->fType |= MF_POPUP;
- }
- else
- {
- MenuItem->fType &= ~MF_POPUP;
- }
- }
- else
- {
- MenuItem->fType &= ~MF_POPUP;
- }
}
if ((lpmii->fMask & MIIM_STRING) ||
@@ -1469,7 +1450,7 @@
return NO_SELECTED_ITEM;
}
- if (!(mi->fType & MF_POPUP)) continue;
+ if (!(mi->hSubMenu)) continue;
if (mi->hSubMenu == hSubTarget)
{
@@ -2038,7 +2019,7 @@
if (!(ReferenceWnd = UserGetWindowObject(hWnd))) RETURN( FALSE);
- if(MenuItem->fType & MF_POPUP)
+ if(MenuItem->hSubMenu)
{
XMove = ReferenceWnd->rcClient.left;
YMove = ReferenceWnd->rcClient.top;
Modified: branches/shell-experiments/win32ss/user/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/win32ss/user/…
==============================================================================
--- branches/shell-experiments/win32ss/user/user32/windows/menu.c [iso-8859-1] (original)
+++ branches/shell-experiments/win32ss/user/user32/windows/menu.c [iso-8859-1] Mon Mar 3
16:12:39 2014
@@ -396,7 +396,7 @@
MenuCleanupRosMenuItemInfo(&item);
return NO_SELECTED_ITEM;
}
- if (!(item.fType & MF_POPUP)) continue;
+ if (!(item.hSubMenu)) continue;
if (item.hSubMenu == hSubTarget) {
MenuCleanupRosMenuItemInfo(&item);
return i;
@@ -1207,7 +1207,7 @@
dis.rcItem.bottom);
SendMessageW(WndOwner, WM_DRAWITEM, 0, (LPARAM) &dis);
/* Draw the popup-menu arrow */
- if (lpitem->fType & MF_POPUP)
+ if (lpitem->hSubMenu)
{
RECT rectTemp;
CopyRect(&rectTemp, &rect);
@@ -1345,7 +1345,7 @@
}
}
/* Draw the popup-menu arrow */
- if (lpitem->fType & MF_POPUP)
+ if (lpitem->hSubMenu)
{
RECT rectTemp;
CopyRect(&rectTemp, &rect);
@@ -1694,7 +1694,7 @@
if (sendMenuSelect)
{
SendMessageW(hwndOwner, WM_MENUSELECT,
- MAKELONG(ItemInfo.fType & MF_POPUP ? wIndex :
ItemInfo.wID,
+ MAKELONG(ItemInfo.hSubMenu ? wIndex : ItemInfo.wID,
ItemInfo.fType | ItemInfo.fState | MF_MOUSESELECT |
(hmenu->Flags & MF_SYSMENU)), (LPARAM)
hmenu->Self);
}
@@ -2114,8 +2114,7 @@
return NULL;
}
mii.fMask |= MIIM_SUBMENU;
- mii.fType |= MF_POPUP;
- mii.wID = (UINT)mii.hSubMenu;
+ /*mii.wID = (UINT)mii.hSubMenu;*/
}
else if (!mii.dwTypeData[0])
mii.fType |= MF_SEPARATOR;
@@ -2315,7 +2314,7 @@
MenuCleanupRosMenuItemInfo(&ItemInfo);
return MenuInfo->Self;
}
- if (0 == (ItemInfo.fType & MF_POPUP) || 0 != (ItemInfo.fState & (MF_GRAYED |
MF_DISABLED)))
+ if (0 == (ItemInfo.hSubMenu) || 0 != (ItemInfo.fState & (MF_GRAYED |
MF_DISABLED)))
{
MenuCleanupRosMenuItemInfo(&ItemInfo);
return MenuInfo->Self;
@@ -2447,7 +2446,7 @@
MenuInitRosMenuItemInfo(&ItemInfo);
ItemInfo.fMask |= MIIM_FTYPE | MIIM_STATE;
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, MenuInfo->FocusedItem,
&ItemInfo)
- || 0 == (ItemInfo.fType & MF_POPUP)
+ || 0 == (ItemInfo.hSubMenu)
|| 0 == (ItemInfo.fState & MF_MOUSESELECT))
{
MenuCleanupRosMenuItemInfo(&ItemInfo);
@@ -2532,7 +2531,7 @@
TRACE("%p %08x %p\n", MenuInfo, ItemInfo.wID, ItemInfo.hSubMenu);
- if (0 == (ItemInfo.fType & MF_POPUP))
+ if (0 == (ItemInfo.hSubMenu))
{
if (0 == (ItemInfo.fState & (MF_GRAYED | MF_DISABLED))
&& 0 == (ItemInfo.fType & MF_SEPARATOR))
@@ -2663,7 +2662,7 @@
if (0 <= Id && MenuGetRosMenuItemInfo(MenuInfo.Self, Id, &ItemInfo)
&&
MenuInfo.FocusedItem == Id)
{
- if (0 == (ItemInfo.fType & MF_POPUP))
+ if (0 == (ItemInfo.hSubMenu))
{
INT ExecutedMenuId = MenuExecFocusedItem(Mt, &MenuInfo, Flags);
MenuCleanupRosMenuItemInfo(&ItemInfo);
@@ -2712,7 +2711,7 @@
{
MenuInitRosMenuItemInfo(&ItemInfo);
if (MenuGetRosMenuItemInfo(MenuInfo.Self, MenuInfo.FocusedItem, &ItemInfo)
&&
- 0 != (ItemInfo.fType & MF_POPUP) &&
+ 0 != (ItemInfo.hSubMenu) &&
0 != (ItemInfo.fState & MF_MOUSESELECT))
{
Ret = MenuPtMenu(ItemInfo.hSubMenu, Pt);
@@ -2826,7 +2825,7 @@
MenuCleanupRosMenuItemInfo(&ItemInfo);
return NULL;
}
- if (0 != (ItemInfo.fType & MF_POPUP) && 0 != (ItemInfo.fState &
MF_MOUSESELECT))
+ if (0 != (ItemInfo.hSubMenu) && 0 != (ItemInfo.fState & MF_MOUSESELECT))
{
MenuCleanupRosMenuItemInfo(&ItemInfo);
return ItemInfo.hSubMenu;
@@ -3885,7 +3884,6 @@
if(Flags & MF_POPUP)
{
- mii->fType |= MF_POPUP;
mii->fMask |= MIIM_SUBMENU;
mii->hSubMenu = (HMENU)IDNewItem;
}
@@ -3995,7 +3993,7 @@
if (0 != (Items[i].fType & MF_MENUBARBREAK)) continue;
if (0 != (Items[i].fType & MF_SEPARATOR)) continue;
- if ((Items[i].fType & MF_POPUP) && (uFlags == MF_BYCOMMAND))
+ if ((Items[i].hSubMenu) && (uFlags == MF_BYCOMMAND))
{
MenuCheckMenuRadioItem(Items[i].hSubMenu, idFirst, idLast, idCheck, uFlags, bCheck,
pChecked, pUnchecked, pMenuChanged);
continue;
@@ -4899,7 +4897,7 @@
if(!MenuGetRosMenuItemInfo( hMnu, uPosition, &rmii)) return FALSE;
- if ((rmii.fType & MF_POPUP) && (uFlags & MF_POPUP) &&
(rmii.hSubMenu != (HMENU)uIDNewItem))
+ if ((rmii.hSubMenu) && (uFlags & MF_POPUP) && (rmii.hSubMenu !=
(HMENU)uIDNewItem))
NtUserDestroyMenu( rmii.hSubMenu ); /* ModifyMenu() spec */
MenuCleanupRosMenuItemInfo( &rmii );
@@ -4946,7 +4944,7 @@
if(!MenuGetRosMenuItemInfo( hMnu, uPosition, &rmii)) return FALSE;
- if ((rmii.fType & MF_POPUP) && (uFlags & MF_POPUP) &&
(rmii.hSubMenu != (HMENU)uIDNewItem))
+ if ((rmii.hSubMenu) && (uFlags & MF_POPUP) && (rmii.hSubMenu !=
(HMENU)uIDNewItem))
NtUserDestroyMenu( rmii.hSubMenu ); /* ModifyMenu() spec */
MenuCleanupRosMenuItemInfo( &rmii );