set_menu_item_text handles converting an empty menu item to a separator on its own

Dmitry Timoshkov dmitry at baikal.ru
Mon Nov 28 00:12:45 CST 2005


Hello,

this patch removes one of the todo_wine statements from the menu test.

Currently SetMenuItemInfo_common in the MIIM_FTYPE case sets menu->text
to NULL and without giving a chance to set_menu_item_text to set menu item
text blindly adds MF_SEPARATOR if menu->text is NULL.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    set_menu_item_text handles converting an empty menu item to a separator
    on its own, give it a chance to do its work in the MIIM_FTYPE case.

diff -up cvs/hq/wine/dlls/user/menu.c wine/dlls/user/menu.c
--- cvs/hq/wine/dlls/user/menu.c	2005-11-10 11:28:36.000000000 +0800
+++ wine/dlls/user/menu.c	2005-11-28 13:50:11.000000000 +0800
@@ -4230,10 +4230,10 @@ static BOOL SetMenuItemInfo_common(MENUI
 	menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
 	menu->fType |= MENU_ITEM_TYPE(lpmii->fType);
 
-	menu->text = lpmii->dwTypeData;
-
-       if (IS_STRING_ITEM(menu->fType))
-           set_menu_item_text( menu, lpmii->dwTypeData, unicode );
+        if (IS_STRING_ITEM(menu->fType))
+            set_menu_item_text( menu, lpmii->dwTypeData, unicode );
+        else
+            menu->text = lpmii->dwTypeData;
     }
 
     if (lpmii->fMask & MIIM_FTYPE ) {
@@ -4244,8 +4244,11 @@ static BOOL SetMenuItemInfo_common(MENUI
 	}
 	menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
 	menu->fType |= MENU_ITEM_TYPE(lpmii->fType);
-        if ( IS_STRING_ITEM(menu->fType) && !menu->text )
-            menu->fType |= MF_SEPARATOR;
+
+        if (IS_STRING_ITEM(menu->fType))
+            set_menu_item_text( menu, lpmii->dwTypeData, unicode );
+        else
+            menu->text = lpmii->dwTypeData;
     }
 
     if (lpmii->fMask & MIIM_STRING ) {
diff -up cvs/hq/wine/dlls/user/tests/menu.c wine/dlls/user/tests/menu.c
--- cvs/hq/wine/dlls/user/tests/menu.c	2005-11-14 13:12:18.000000000 +0800
+++ wine/dlls/user/tests/menu.c	2005-11-28 13:59:05.000000000 +0800
@@ -277,9 +277,7 @@ static void test_menu_add_string( void )
     string[0] = 0;
     GetMenuItemInfo( hmenu, 0, TRUE, &info );
 
-    todo_wine {
     ok( !strcmp( string, "blah" ), "menu item name differed\n");
-    }
 
     DestroyMenu( hmenu );
 }






More information about the wine-patches mailing list