[ros-diffs] [cfinck] 33958: Revert parts of r33578: - First of all, MenuSetItemData is only called from InsertMenuA/W and ModifyMenuA/W. Therefore the passed MENUITEMINFO structure will always be empty, so it makes no sense to check for flags in this structure. This way, I could simplify the code block for MF_BITMAP. - Also fType = MFT_BITMAP and fMask = MIIM_BITMAP at the same time passed to win32k don't work. Changing this back to only set fMask fixes bitmap menus. - Furthermore the data for MF_OWNERDRAW is really stored in dwItemData and not in dwTypeData. The MSDN documentation for InsertMenu applies here, not the one for the MENUITEMINFO structure. This fixes owner-drawn menus like the one in Abiword. See issue #3272 for more details.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sat Jun 14 01:14:28 CEST 2008


Author: cfinck
Date: Fri Jun 13 18:14:27 2008
New Revision: 33958

URL: http://svn.reactos.org/svn/reactos?rev=33958&view=rev
Log:
Revert parts of r33578:
- First of all, MenuSetItemData is only called from InsertMenuA/W and ModifyMenuA/W.
  Therefore the passed MENUITEMINFO structure will always be empty, so it makes no sense to check for flags in this structure.
  This way, I could simplify the code block for MF_BITMAP.
- Also fType = MFT_BITMAP and fMask = MIIM_BITMAP at the same time passed to win32k don't work.
  Changing this back to only set fMask fixes bitmap menus.
- Furthermore the data for MF_OWNERDRAW is really stored in dwItemData and not in dwTypeData.
  The MSDN documentation for InsertMenu applies here, not the one for the MENUITEMINFO structure.
  This fixes owner-drawn menus like the one in Abiword.

See issue #3272 for more details.

Modified:
    trunk/reactos/dll/win32/user32/windows/menu.c

Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/menu.c?rev=33958&r1=33957&r2=33958&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Fri Jun 13 18:14:27 2008
@@ -3712,20 +3712,8 @@
  */
   if(Flags & MF_BITMAP)
   {
-     if (mii->fType & MFT_BITMAP)
-     {
-       /* use old way of storing bitmap */
-       mii->fMask |= (MIIM_TYPE  | MIIM_FTYPE);
-       mii->fType |= MF_BITMAP;
-       mii->dwTypeData = (LPWSTR)NewItem;
-     }
-     else
-     {
-         /* use new way of storing type */
-         mii->hbmpItem = (HBITMAP) NewItem;
-         mii->fType |= MFT_BITMAP;
-         mii->fMask |= MIIM_BITMAP;
-     }
+     mii->fMask |= MIIM_BITMAP;   /* Use the new way of seting hbmpItem.*/
+     mii->hbmpItem = (HBITMAP) NewItem;
 
      if (Flags & MF_HELP)
      {
@@ -3736,8 +3724,8 @@
   else if(Flags & MF_OWNERDRAW)
   {
     mii->fType |= MFT_OWNERDRAW;
-    mii->fMask |= (MIIM_TYPE  | MIIM_FTYPE);
-    mii->dwTypeData = (LPWSTR) NewItem;
+    mii->fMask |= MIIM_DATA;
+    mii->dwItemData = (DWORD) NewItem;
   }
   else if (Flags & MF_SEPARATOR)
   {



More information about the Ros-diffs mailing list