mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
[Win32k]
- Patch by David Quintana : Menu info fType and wID have wrong values if the menu has a submenu. See CORE-7966. svn path=/trunk/; revision=62529
This commit is contained in:
parent
6e6984882a
commit
ac46205375
|
@ -458,7 +458,7 @@ IntSetMenuInfo(PMENU_OBJECT Menu, PROSMENUINFO lpmi)
|
|||
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 @@ IntGetMenuItemByFlag(PMENU_OBJECT Menu, UINT uSearchBy, UINT fFlag,
|
|||
}
|
||||
else
|
||||
{
|
||||
if(CurItem->fType & MF_POPUP)
|
||||
if(CurItem->hSubMenu)
|
||||
{
|
||||
PMENU_OBJECT NewMenu = UserGetMenuObject(CurItem->hSubMenu);
|
||||
if(NewMenu)
|
||||
|
@ -664,7 +664,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)
|
||||
{
|
||||
|
@ -752,16 +752,7 @@ IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, PROSMENUITEMINF
|
|||
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 @@ UINT FASTCALL IntFindSubMenu(HMENU *hMenu, HMENU hSubTarget )
|
|||
return NO_SELECTED_ITEM;
|
||||
}
|
||||
|
||||
if (!(mi->fType & MF_POPUP)) continue;
|
||||
if (!(mi->hSubMenu)) continue;
|
||||
|
||||
if (mi->hSubMenu == hSubTarget)
|
||||
{
|
||||
|
|
|
@ -977,7 +977,7 @@ IntGetSystemMenu(PWND Window, BOOL bRevert, BOOL RetMenu)
|
|||
|
||||
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;
|
||||
|
|
|
@ -399,7 +399,7 @@ static UINT FASTCALL MenuFindSubMenu(HMENU *hmenu, HMENU hSubTarget )
|
|||
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 @@ static void FASTCALL MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND Wnd
|
|||
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 @@ static void FASTCALL MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND Wnd
|
|||
}
|
||||
}
|
||||
/* Draw the popup-menu arrow */
|
||||
if (lpitem->fType & MF_POPUP)
|
||||
if (lpitem->hSubMenu)
|
||||
{
|
||||
RECT rectTemp;
|
||||
CopyRect(&rectTemp, &rect);
|
||||
|
@ -1706,16 +1706,19 @@ static void FASTCALL MenuSelectItem(HWND hwndOwner, PROSMENUINFO hmenu, UINT wIn
|
|||
}
|
||||
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 @@ static void FASTCALL MenuSelectItem(HWND hwndOwner, PROSMENUINFO hmenu, UINT wIn
|
|||
&& 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 @@ static LPCSTR MENUEX_ParseResource(LPCSTR res, HMENU hMenu)
|
|||
return NULL;
|
||||
}
|
||||
mii.fMask |= MIIM_SUBMENU;
|
||||
mii.fType |= MF_POPUP;
|
||||
}
|
||||
else if (!mii.dwTypeData[0] && !(mii.fType & MF_SEPARATOR))
|
||||
{
|
||||
|
@ -2300,7 +2303,7 @@ MenuShowSubPopup(HWND WndOwner, PROSMENUINFO MenuInfo, BOOL SelectFirst, UINT Fl
|
|||
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 @@ MenuHideSubPopups(HWND WndOwner, PROSMENUINFO MenuInfo,
|
|||
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 @@ MenuExecFocusedItem(MTRACKER *Mt, PROSMENUINFO MenuInfo, UINT Flags)
|
|||
|
||||
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 @@ MenuButtonUp(MTRACKER *Mt, HMENU PtMenu, UINT Flags)
|
|||
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 @@ MenuPtMenu(HMENU Menu, POINT Pt)
|
|||
{
|
||||
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 @@ MenuGetSubPopup(HMENU Menu)
|
|||
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 @@ MenuSetItemData(
|
|||
|
||||
if(Flags & MF_POPUP)
|
||||
{
|
||||
mii->fType |= MF_POPUP;
|
||||
mii->fMask |= MIIM_SUBMENU;
|
||||
mii->hSubMenu = (HMENU)IDNewItem;
|
||||
}
|
||||
|
@ -3993,7 +3995,7 @@ MenuCheckMenuRadioItem(HMENU hMenu, UINT idFirst, UINT idLast, UINT idCheck, UIN
|
|||
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 @@ ModifyMenuA(
|
|||
|
||||
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 @@ ModifyMenuW(
|
|||
|
||||
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 );
|
||||
|
|
Loading…
Reference in a new issue