aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-06-29 18:43:24 +0000
committerRichard M. Stallman1995-06-29 18:43:24 +0000
commit71dca3e3da179d831d3a9426d3ee208cc783b6a4 (patch)
treeee3077aa84f59a5df1bca6ec0f1a793a6b125ea2 /src
parent5d46f92806a6b2282b591a68f69906a387c8410a (diff)
downloademacs-71dca3e3da179d831d3a9426d3ee208cc783b6a4.tar.gz
emacs-71dca3e3da179d831d3a9426d3ee208cc783b6a4.zip
(single_submenu): Handle commands appearing directly in the menu bar.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index f8d3b143ceb..54b1d50e096 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1300,6 +1300,7 @@ single_submenu (item_key, item_name, maps)
1300 widget_value **submenu_stack; 1300 widget_value **submenu_stack;
1301 int mapno; 1301 int mapno;
1302 int previous_items = menu_items_used; 1302 int previous_items = menu_items_used;
1303 int top_level_items = 0;
1303 1304
1304 length = Flength (maps); 1305 length = Flength (maps);
1305 len = XINT (length); 1306 len = XINT (length);
@@ -1317,7 +1318,16 @@ single_submenu (item_key, item_name, maps)
1317 /* Loop over the given keymaps, making a pane for each map. 1318 /* Loop over the given keymaps, making a pane for each map.
1318 But don't make a pane that is empty--ignore that map instead. */ 1319 But don't make a pane that is empty--ignore that map instead. */
1319 for (i = 0; i < len; i++) 1320 for (i = 0; i < len; i++)
1320 single_keymap_panes (mapvec[i], item_name, item_key, 0); 1321 {
1322 if (SYMBOLP (mapvec[i]))
1323 {
1324 top_level_items = 1;
1325 push_menu_pane (Qnil, Qnil);
1326 push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil);
1327 }
1328 else
1329 single_keymap_panes (mapvec[i], item_name, item_key, 0);
1330 }
1321 1331
1322 /* Create a tree of widget_value objects 1332 /* Create a tree of widget_value objects
1323 representing the panes and their items. */ 1333 representing the panes and their items. */
@@ -1330,6 +1340,7 @@ single_submenu (item_key, item_name, maps)
1330 wv->enabled = 1; 1340 wv->enabled = 1;
1331 first_wv = wv; 1341 first_wv = wv;
1332 save_wv = 0; 1342 save_wv = 0;
1343 prev_wv = 0;
1333 1344
1334 /* Loop over all panes and items made during this call 1345 /* Loop over all panes and items made during this call
1335 and construct a tree of widget_value objects. 1346 and construct a tree of widget_value objects.
@@ -1405,8 +1416,9 @@ single_submenu (item_key, item_name, maps)
1405 wv = malloc_widget_value (); 1416 wv = malloc_widget_value ();
1406 if (prev_wv) 1417 if (prev_wv)
1407 prev_wv->next = wv; 1418 prev_wv->next = wv;
1408 else 1419 else
1409 save_wv->contents = wv; 1420 save_wv->contents = wv;
1421
1410 wv->name = (char *) XSTRING (item_name)->data; 1422 wv->name = (char *) XSTRING (item_name)->data;
1411 if (!NILP (descrip)) 1423 if (!NILP (descrip))
1412 wv->key = (char *) XSTRING (descrip)->data; 1424 wv->key = (char *) XSTRING (descrip)->data;
@@ -1421,6 +1433,15 @@ single_submenu (item_key, item_name, maps)
1421 } 1433 }
1422 } 1434 }
1423 1435
1436 /* If we have just one "menu item"
1437 that was originally a button, return it by itself. */
1438 if (top_level_items && first_wv->contents && first_wv->contents->next == 0)
1439 {
1440 wv = first_wv->contents;
1441 free_widget_value (first_wv);
1442 return wv;
1443 }
1444
1424 return first_wv; 1445 return first_wv;
1425} 1446}
1426 1447