Author: jimtabor
Date: Tue Mar 18 13:45:38 2014
New Revision: 62529
URL:
http://svn.reactos.org/svn/reactos?rev=62529&view=rev
Log:
[Win32k]
- Patch by David Quintana : Menu info fType and wID have wrong values if the menu has a
submenu. See CORE-7966.
Modified:
trunk/reactos/win32ss/user/ntuser/menu.c
trunk/reactos/win32ss/user/ntuser/window.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 13:45:38 2014
@@ -458,7 +458,7 @@
PMENU_ITEM item = Menu->MenuItemList;
for ( i = Menu->MenuInfo.MenuItemCount; i; i--, item = item->Next)
{
- if ( item->fType & MF_POPUP ) // item->hSubMenu )
+ if ( item->hSubMenu )
{
PMENU_OBJECT SubMenu;
if (!(SubMenu = UserGetMenuObject(item->hSubMenu))) continue;
@@ -539,7 +539,7 @@
}
else
{
- if(CurItem->fType & MF_POPUP)
+ if(CurItem->hSubMenu)
{
PMENU_OBJECT NewMenu = UserGetMenuObject(CurItem->hSubMenu);
if(NewMenu)
@@ -664,7 +664,7 @@
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)
{
@@ -752,16 +752,7 @@
if (SubMenuObject != NULL)
{
SubMenuObject->MenuInfo.Flags |= MNF_POPUP;
- MenuItem->fType |= MF_POPUP;
}
- else
- {
- MenuItem->fType &= ~MF_POPUP;
- }
- }
- else
- {
- MenuItem->fType &= ~MF_POPUP;
}
}
@@ -1479,7 +1470,7 @@
return NO_SELECTED_ITEM;
}
- if (!(mi->fType & MF_POPUP)) continue;
+ if (!(mi->hSubMenu)) continue;
if (mi->hSubMenu == hSubTarget)
{
Modified: trunk/reactos/win32ss/user/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Tue Mar 18 13:45:38 2014
@@ -977,7 +977,7 @@
ItemInfo.cbSize = sizeof(MENUITEMINFOW);
ItemInfo.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE | MIIM_SUBMENU;
- ItemInfo.fType = MF_POPUP;
+ ItemInfo.fType = 0;
ItemInfo.fState = MFS_ENABLED;
ItemInfo.dwTypeData = NULL;
ItemInfo.cch = 0;
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 13:45:38
2014
@@ -399,7 +399,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;
@@ -1214,7 +1214,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);
@@ -1352,7 +1352,7 @@
}
}
/* Draw the popup-menu arrow */
- if (lpitem->fType & MF_POPUP)
+ if (lpitem->hSubMenu)
{
RECT rectTemp;
CopyRect(&rectTemp, &rect);
@@ -1706,16 +1706,19 @@
}
if (sendMenuSelect)
{
- WPARAM wParam = MAKEWPARAM( ItemInfo.fType & MF_POPUP ? wIndex :
ItemInfo.wID,
+ WPARAM wParam = MAKEWPARAM( ItemInfo.hSubMenu ? wIndex : ItemInfo.wID,
ItemInfo.fType | ItemInfo.fState |
- (hmenu->Flags & MNF_SYSDESKMN ?
MF_SYSMENU : 0 ) );
+ (ItemInfo.hSubMenu ? MF_POPUP : 0) |
+ (hmenu->Flags & MNF_SYSDESKMN ?
MF_SYSMENU : 0 ) );
SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) hmenu->Self);
}
}
}
- else if (sendMenuSelect) {
- if(topmenu) {
+ else if (sendMenuSelect)
+ {
+ if(topmenu)
+ {
int pos;
pos = MenuFindSubMenu(&topmenu, hmenu->Self);
if (pos != NO_SELECTED_ITEM)
@@ -1724,6 +1727,7 @@
&& MenuGetRosMenuItemInfo(topmenu, pos, &ItemInfo))
{
WPARAM wParam = MAKEWPARAM( Pos, ItemInfo.fType | ItemInfo.fState |
+ (ItemInfo.hSubMenu ? MF_POPUP : 0) |
(TopMenuInfo.Flags & MNF_SYSDESKMN ?
MF_SYSMENU : 0 ) );
SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) topmenu);
@@ -2100,7 +2104,6 @@
return NULL;
}
mii.fMask |= MIIM_SUBMENU;
- mii.fType |= MF_POPUP;
}
else if (!mii.dwTypeData[0] && !(mii.fType & MF_SEPARATOR))
{
@@ -2300,7 +2303,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;
@@ -2441,7 +2444,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);
@@ -2526,7 +2529,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))
@@ -2660,7 +2663,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);
@@ -2709,7 +2712,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);
@@ -2823,7 +2826,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;
@@ -3883,7 +3886,6 @@
if(Flags & MF_POPUP)
{
- mii->fType |= MF_POPUP;
mii->fMask |= MIIM_SUBMENU;
mii->hSubMenu = (HMENU)IDNewItem;
}
@@ -3993,7 +3995,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;
@@ -4897,7 +4899,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 );
@@ -4944,7 +4946,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 );