Index: trunk/src/user32/menu.c
===================================================================
--- trunk/src/user32/menu.c	(revision 9598)
+++ trunk/src/user32/menu.c	(revision 9599)
@@ -1207,5 +1207,5 @@
         dis.itemState = 0;
         if (lpitem->fState & MF_CHECKED) dis.itemState |= ODS_CHECKED;
-        if (lpitem->fState & MF_GRAYED)  dis.itemState |= ODS_GRAYED;
+        if (lpitem->fState & MF_GRAYED)  dis.itemState |= ODS_GRAYED|ODS_DISABLED;
         if (lpitem->fState & MF_HILITE)  dis.itemState |= ODS_SELECTED;
         dis.itemAction = odaction; /* ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS; */
@@ -1972,6 +1972,4 @@
             res += sizeof(WORD);
         }
-        if (!IS_STRING_ITEM(flags))
-            ERR("not a string item %04x\n", flags );
         str = res;
         if (!unicode) res += strlen(str) + 1;
@@ -2038,8 +2036,14 @@
 		DestroyMenu(mii.hSubMenu);
                 return NULL;
-        }
+            }
 	    mii.fMask |= MIIM_SUBMENU;
 	    mii.fType |= MF_POPUP;
         }
+	else if(!*mii.dwTypeData && !(mii.fType & MF_SEPARATOR))
+	{
+	    WARN("Converting NULL menu item %04x, type %04x to SEPARATOR\n",
+		mii.wID, mii.fType);
+	    mii.fType |= MF_SEPARATOR;
+	}
 	InsertMenuItemW(hMenu, -1, MF_BYPOSITION, &mii);
     } while (!(resinfo & MF_END));
@@ -2823,12 +2827,10 @@
 	{
             /*
-             * use the mouse coordinates in lParam instead of those in the MSG
-             * struct to properly handle synthetic messages. lParam coords are
-             * relative to client area, so they must be converted; since they can
-             * be negative, we must use SLOWORD/SHIWORD instead of LOWORD/HIWORD.
+             * Use the mouse coordinates in lParam instead of those in the MSG
+             * struct to properly handle synthetic messages. They are already
+             * in screen coordinates.
              */
             mt.pt.x = SLOWORD(msg.lParam);
             mt.pt.y = SHIWORD(msg.lParam);
-            ClientToScreen(msg.hwnd,&mt.pt);
 
 	    /* Find a menu for this mouse event */
@@ -3333,30 +3335,4 @@
 
 /*******************************************************************
- *         ChangeMenu    (USER.153)
- */
-BOOL16 WINAPI ChangeMenu16( HMENU16 hMenu, UINT16 pos, SEGPTR data,
-                            UINT16 id, UINT16 flags )
-{
-    TRACE("menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n",
-                  hMenu, pos, (DWORD)data, id, flags );
-    if (flags & MF_APPEND) return AppendMenu16( hMenu, flags & ~MF_APPEND,
-                                                id, data );
-
-    /* FIXME: Word passes the item id in 'pos' and 0 or 0xffff as id */
-    /* for MF_DELETE. We should check the parameters for all others */
-    /* MF_* actions also (anybody got a doc on ChangeMenu?). */
-
-    if (flags & MF_DELETE) return DeleteMenu16(hMenu, pos, flags & ~MF_DELETE);
-    if (flags & MF_CHANGE) return ModifyMenu16(hMenu, pos, flags & ~MF_CHANGE,
-                                               id, data );
-    if (flags & MF_REMOVE) return RemoveMenu16(hMenu,
-                                              flags & MF_BYPOSITION ? pos : id,
-                                              flags & ~MF_REMOVE );
-    /* Default: MF_INSERT */
-    return InsertMenu16( hMenu, pos, flags, id, data );
-}
-
-
-/*******************************************************************
  *         ChangeMenuA    (USER32.@)
  */
@@ -3401,13 +3377,4 @@
 
 /*******************************************************************
- *         CheckMenuItem    (USER.154)
- */
-BOOL16 WINAPI CheckMenuItem16( HMENU16 hMenu, UINT16 id, UINT16 flags )
-{
-    return (BOOL16)CheckMenuItem( hMenu, id, flags );
-}
-
-
-/*******************************************************************
  *         CheckMenuItem    (USER32.@)
  */
@@ -3423,13 +3390,4 @@
     else item->fState &= ~MF_CHECKED;
     return ret;
-}
-
-
-/**********************************************************************
- *         EnableMenuItem    (USER.155)
- */
-UINT16 WINAPI EnableMenuItem16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
-{
-    return EnableMenuItem( hMenu, wItemID, wFlags );
 }
 
@@ -3476,14 +3434,4 @@
 
     return oldflags;
-}
-
-
-/*******************************************************************
- *         GetMenuString    (USER.161)
- */
-INT16 WINAPI GetMenuString16( HMENU16 hMenu, UINT16 wItemID,
-                              LPSTR str, INT16 nMaxSiz, UINT16 wFlags )
-{
-    return GetMenuStringA( hMenu, wItemID, str, nMaxSiz, wFlags );
 }
 
@@ -3552,13 +3500,4 @@
 
 /**********************************************************************
- *         GetMenuState    (USER.250)
- */
-UINT16 WINAPI GetMenuState16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
-{
-    return GetMenuState( hMenu, wItemID, wFlags );
-}
-
-
-/**********************************************************************
  *         GetMenuState    (USER32.@)
  */
@@ -3587,7 +3526,7 @@
 
 /**********************************************************************
- *         GetMenuItemCount    (USER.263)
- */
-INT16 WINAPI GetMenuItemCount16( HMENU16 hMenu )
+ *         GetMenuItemCount    (USER32.@)
+ */
+INT WINAPI GetMenuItemCount( HMENU hMenu )
 {
     LPPOPUPMENU	menu = MENU_GetMenu(hMenu);
@@ -3598,17 +3537,4 @@
 }
 
-
-/**********************************************************************
- *         GetMenuItemCount    (USER32.@)
- */
-INT WINAPI GetMenuItemCount( HMENU hMenu )
-{
-    LPPOPUPMENU	menu = MENU_GetMenu(hMenu);
-    if (!menu) return -1;
-    TRACE("(%04x) returning %d\n",
-                  hMenu, menu->nItems );
-    return menu->nItems;
-}
-
 /**********************************************************************
  *         GetMenuItemID    (USER.264)
@@ -3630,17 +3556,4 @@
     return lpmi->wID;
 
-}
-
-/*******************************************************************
- *         InsertMenu    (USER.410)
- */
-BOOL16 WINAPI InsertMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags,
-                            UINT16 id, SEGPTR data )
-{
-    UINT pos32 = (UINT)pos;
-    if ((pos == (UINT16)-1) && (flags & MF_BYPOSITION)) pos32 = (UINT)-1;
-    if (IS_STRING_ITEM(flags) && data)
-        return InsertMenuA( hMenu, pos32, flags, id, MapSL(data) );
-    return InsertMenuA( hMenu, pos32, flags, id, (LPSTR)data );
 }
 
@@ -3703,13 +3616,4 @@
 
 /*******************************************************************
- *         AppendMenu    (USER.411)
- */
-BOOL16 WINAPI AppendMenu16(HMENU16 hMenu, UINT16 flags, UINT16 id, SEGPTR data)
-{
-    return InsertMenu16( hMenu, -1, flags | MF_BYPOSITION, id, data );
-}
-
-
-/*******************************************************************
  *         AppendMenuA    (USER32.@)
  */
@@ -3728,13 +3632,4 @@
 {
     return InsertMenuW( hMenu, -1, flags | MF_BYPOSITION, id, data );
-}
-
-
-/**********************************************************************
- *         RemoveMenu   (USER.412)
- */
-BOOL16 WINAPI RemoveMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags )
-{
-    return RemoveMenu( hMenu, nPos, wFlags );
 }
 
@@ -3773,13 +3668,4 @@
     }
     return TRUE;
-}
-
-
-/**********************************************************************
- *         DeleteMenu    (USER.413)
- */
-BOOL16 WINAPI DeleteMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags )
-{
-    return DeleteMenu( hMenu, nPos, wFlags );
 }
 
@@ -3796,16 +3682,4 @@
     RemoveMenu( hMenu, nPos, wFlags | MF_BYPOSITION );
     return TRUE;
-}
-
-
-/*******************************************************************
- *         ModifyMenu    (USER.414)
- */
-BOOL16 WINAPI ModifyMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags,
-                            UINT16 id, SEGPTR data )
-{
-    if (IS_STRING_ITEM(flags))
-        return ModifyMenuA( hMenu, pos, flags, id, MapSL(data) );
-    return ModifyMenuA( hMenu, pos, flags, id, (LPSTR)data );
 }
 
@@ -3861,13 +3735,4 @@
 
 /**********************************************************************
- *         CreatePopupMenu    (USER.415)
- */
-HMENU16 WINAPI CreatePopupMenu16(void)
-{
-    return CreatePopupMenu();
-}
-
-
-/**********************************************************************
  *         CreatePopupMenu    (USER32.@)
  */
@@ -3896,14 +3761,4 @@
 
 /**********************************************************************
- *         SetMenuItemBitmaps    (USER.418)
- */
-BOOL16 WINAPI SetMenuItemBitmaps16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags,
-                                    HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck)
-{
-    return SetMenuItemBitmaps( hMenu, nPos, wFlags, hNewUnCheck, hNewCheck );
-}
-
-
-/**********************************************************************
  *         SetMenuItemBitmaps    (USER32.@)
  */
@@ -3927,13 +3782,4 @@
     }
     return TRUE;
-}
-
-
-/**********************************************************************
- *         CreateMenu    (USER.151)
- */
-HMENU16 WINAPI CreateMenu16(void)
-{
-    return CreateMenu();
 }
 
@@ -3962,13 +3808,4 @@
 
     return hMenu;
-}
-
-
-/**********************************************************************
- *         DestroyMenu    (USER.152)
- */
-BOOL16 WINAPI DestroyMenu16( HMENU16 hMenu )
-{
-    return DestroyMenu( hMenu );
 }
 
@@ -4209,13 +4046,4 @@
 }
 
-
-
-/**********************************************************************
- *         GetSubMenu    (USER.159)
- */
-HMENU16 WINAPI GetSubMenu16( HMENU16 hMenu, INT16 nPos )
-{
-    return GetSubMenu( hMenu, nPos );
-}
 
 
@@ -4440,13 +4268,4 @@
 
 /**********************************************************************
- *		IsMenu    (USER.358)
- */
-BOOL16 WINAPI IsMenu16( HMENU16 hmenu )
-{
-    return IsMenu( hmenu );
-}
-
-
-/**********************************************************************
  *		IsMenu    (USER32.@)
  */
@@ -4790,30 +4609,4 @@
 }
 
-/*******************************************************************
- *              InsertMenuItem   (USER.441)
- *
- * FIXME: untested
- */
-BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition,
-                                const MENUITEMINFO16 *mii )
-{
-    MENUITEMINFOA miia;
-
-    miia.cbSize        = sizeof(miia);
-    miia.fMask         = mii->fMask;
-    miia.dwTypeData    = (LPSTR)mii->dwTypeData;
-    miia.fType         = mii->fType;
-    miia.fState        = mii->fState;
-    miia.wID           = mii->wID;
-    miia.hSubMenu      = mii->hSubMenu;
-    miia.hbmpChecked   = mii->hbmpChecked;
-    miia.hbmpUnchecked = mii->hbmpUnchecked;
-    miia.dwItemData    = mii->dwItemData;
-    miia.cch           = mii->cch;
-    if (IS_STRING_ITEM(miia.fType))
-        miia.dwTypeData = MapSL(mii->dwTypeData);
-    return InsertMenuItemA( hmenu, pos, byposition, &miia );
-}
-
 
 /**********************************************************************
@@ -4878,14 +4671,4 @@
 
 /**********************************************************************
- *		CheckMenuRadioItem (USER.666)
- */
-BOOL16 WINAPI CheckMenuRadioItem16(HMENU16 hMenu,
-				   UINT16 first, UINT16 last, UINT16 check,
-				   BOOL16 bypos)
-{
-     return CheckMenuRadioItem (hMenu, first, last, check, bypos);
-}
-
-/**********************************************************************
  *		GetMenuItemRect    (USER32.@)
  *
@@ -5001,13 +4784,4 @@
 
 /**********************************************************************
- *         SetMenuContextHelpId    (USER.384)
- */
-BOOL16 WINAPI SetMenuContextHelpId16( HMENU16 hMenu, DWORD dwContextHelpID)
-{
-	return SetMenuContextHelpId( hMenu, dwContextHelpID );
-}
-
-
-/**********************************************************************
  *         SetMenuContextHelpId    (USER32.@)
  */
@@ -5024,12 +4798,4 @@
     }
     return FALSE;
-}
-
-/**********************************************************************
- *         GetMenuContextHelpId    (USER.385)
- */
-DWORD WINAPI GetMenuContextHelpId16( HMENU16 hMenu )
-{
-	return GetMenuContextHelpId( hMenu );
 }
 
