diff options
Diffstat (limited to 'src/libui_sdl/libui/unix/menu.c')
-rw-r--r-- | src/libui_sdl/libui/unix/menu.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libui_sdl/libui/unix/menu.c b/src/libui_sdl/libui/unix/menu.c index d6aa398..d641426 100644 --- a/src/libui_sdl/libui/unix/menu.c +++ b/src/libui_sdl/libui/unix/menu.c @@ -305,13 +305,13 @@ static void appendMenuItem(GtkMenuShell *submenu, uiMenuItem *item, uiWindow *w) { int j; uiMenu* m; - GtkWidget *submenu; + GtkWidget *c_submenu; m = item->popupchild; - submenu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); + c_submenu = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), c_submenu); for (j = 0; j < m->items->len; j++) - appendMenuItem(GTK_MENU_SHELL(submenu), g_array_index(m->items, uiMenuItem *, j), w); + appendMenuItem(GTK_MENU_SHELL(c_submenu), g_array_index(m->items, uiMenuItem *, j), w); } } @@ -347,6 +347,7 @@ GtkWidget *makeMenubar(uiWindow *w) struct freeMenuItemData { GArray *items; guint i; + guint* parent_i; }; static void freeMenu(GtkWidget *widget, gpointer data); @@ -359,7 +360,7 @@ static void freeMenuItem(GtkWidget *widget, gpointer data) item = g_array_index(fmi->items, uiMenuItem *, fmi->i); if (item->popupchild != NULL) - freeMenu(widget, &item->popupchild->id); + freeMenu(widget, fmi->parent_i);//&item->popupchild->id); w = (struct menuItemWindow *) g_hash_table_lookup(item->windows, widget); if (g_hash_table_remove(item->windows, widget) == FALSE) implbug("GtkMenuItem %p not in menu item's item/window map", widget); @@ -374,14 +375,16 @@ static void freeMenu(GtkWidget *widget, gpointer data) GtkMenuItem *item; GtkWidget *submenu; struct freeMenuItemData fmi; - + m = g_array_index(menus, uiMenu *, *i); item = GTK_MENU_ITEM(widget); submenu = gtk_menu_item_get_submenu(item); fmi.items = m->items; fmi.i = 0; - gtk_container_foreach(GTK_CONTAINER(submenu), freeMenuItem, &fmi); (*i)++; + fmi.parent_i = i; + gtk_container_foreach(GTK_CONTAINER(submenu), freeMenuItem, &fmi); + //(*i)++; } void freeMenubar(GtkWidget *mb) |