widget_value **submenu_stack;
int mapno;
int previous_items = menu_items_used;
+ int top_level_items = 0;
length = Flength (maps);
len = XINT (length);
/* Loop over the given keymaps, making a pane for each map.
But don't make a pane that is empty--ignore that map instead. */
for (i = 0; i < len; i++)
- single_keymap_panes (mapvec[i], item_name, item_key, 0);
+ {
+ if (SYMBOLP (mapvec[i]))
+ {
+ top_level_items = 1;
+ push_menu_pane (Qnil, Qnil);
+ push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil);
+ }
+ else
+ single_keymap_panes (mapvec[i], item_name, item_key, 0);
+ }
/* Create a tree of widget_value objects
representing the panes and their items. */
wv->enabled = 1;
first_wv = wv;
save_wv = 0;
+ prev_wv = 0;
/* Loop over all panes and items made during this call
and construct a tree of widget_value objects.
wv = malloc_widget_value ();
if (prev_wv)
prev_wv->next = wv;
- else
+ else
save_wv->contents = wv;
+
wv->name = (char *) XSTRING (item_name)->data;
if (!NILP (descrip))
wv->key = (char *) XSTRING (descrip)->data;
}
}
+ /* If we have just one "menu item"
+ that was originally a button, return it by itself. */
+ if (top_level_items && first_wv->contents && first_wv->contents->next == 0)
+ {
+ wv = first_wv->contents;
+ free_widget_value (first_wv);
+ return wv;
+ }
+
return first_wv;
}
\f