problem in menu.c

Dan Timis timis at museresearch.com
Sat Jul 31 18:33:25 CDT 2004


The MS documentation on the structure MENUITEMINFO says that the field 
fMask
indicates what fields to retrieve or set.  Here is what it says about 
the value
MIIM_TYPE:

 > Retrieves or sets the fType and dwTypeData members. Windows 98/Me,
 > Windows 2000/XP: MIIM_TYPE is replaced by MIIM_BITMAP, MIIM_FTYPE,
 > and MIIM_STRING.

So if one wants to specify a text menu item in XP, one would use 
MIIM_STRING,
not MIIM_TYPE.  fType would also need to be MFT_STRING.

In menu.c in GetMenuItemInfo_common():

     /* copy the text string */
     if ((lpmii->fMask & (MIIM_TYPE|MIIM_STRING)) &&
          (MENU_ITEM_TYPE(menu->fType) == MF_STRING) && menu->text)
     {
and so on...

This works fine.  It retrieves the text if either MIIM_TYPE or 
MIIM_STRING are
set.  But, in GetMenuItemInfo_common():

     if (lpmii->fMask & MIIM_TYPE) {
         /* Get rid of old string. */
         if (IS_STRING_ITEM(menu->fType) && menu->text) {
             HeapFree(GetProcessHeap(), 0, menu->text);
             menu->text = NULL;
         }

         /* make only MENU_ITEM_TYPE bits in menu->fType equal 
lpmii->fType */
         menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
         menu->fType |= MENU_ITEM_TYPE(lpmii->fType);

         menu->text = lpmii->dwTypeData;
and so on...

This sets the text only if MIIM_TYPE is set.  I changed the first line 
to:

     if (lpmii->fMask & (MIIM_TYPE|MIIM_STRING)) {

and menus that were drawing before as a long thin vertical line, 
started to
show correctly.  I'm not sure if this is the right way to fix, but it 
works for
this problem.

Dan Timis
Muse Research, Inc.
timis at museresearch.com


Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.184
diff -u -r1.184 menu.c
--- controls/menu.c     19 Jul 2004 21:21:40 -0000      1.184
+++ controls/menu.c     31 Jul 2004 23:02:42 -0000
@@ -4095,7 +4095,7 @@

      debug_print_menuitem("MENU_SetItemInfo_common from: ", menu, "");

-    if (lpmii->fMask & MIIM_TYPE ) {
+    if (lpmii->fMask & (MIIM_TYPE|MIIM_STRING)) {
         /* Get rid of old string. */
         if (IS_STRING_ITEM(menu->fType) && menu->text) {
             HeapFree(GetProcessHeap(), 0, menu->text);





More information about the wine-patches mailing list