diff options
Diffstat (limited to 'src/menu.c')
| -rw-r--r-- | src/menu.c | 64 |
1 files changed, 23 insertions, 41 deletions
diff --git a/src/menu.c b/src/menu.c index 55b1acb3fb9..a90c71219d3 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -87,7 +87,7 @@ int menu_items_n_panes; | |||
| 87 | static int menu_items_submenu_depth; | 87 | static int menu_items_submenu_depth; |
| 88 | 88 | ||
| 89 | void | 89 | void |
| 90 | init_menu_items () | 90 | init_menu_items (void) |
| 91 | { | 91 | { |
| 92 | if (!NILP (menu_items_inuse)) | 92 | if (!NILP (menu_items_inuse)) |
| 93 | error ("Trying to use a menu from within a menu-entry"); | 93 | error ("Trying to use a menu from within a menu-entry"); |
| @@ -107,13 +107,12 @@ init_menu_items () | |||
| 107 | /* Call at the end of generating the data in menu_items. */ | 107 | /* Call at the end of generating the data in menu_items. */ |
| 108 | 108 | ||
| 109 | void | 109 | void |
| 110 | finish_menu_items () | 110 | finish_menu_items (void) |
| 111 | { | 111 | { |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | Lisp_Object | 114 | Lisp_Object |
| 115 | unuse_menu_items (dummy) | 115 | unuse_menu_items (Lisp_Object dummy) |
| 116 | Lisp_Object dummy; | ||
| 117 | { | 116 | { |
| 118 | return menu_items_inuse = Qnil; | 117 | return menu_items_inuse = Qnil; |
| 119 | } | 118 | } |
| @@ -122,7 +121,7 @@ unuse_menu_items (dummy) | |||
| 122 | in menu_items. */ | 121 | in menu_items. */ |
| 123 | 122 | ||
| 124 | void | 123 | void |
| 125 | discard_menu_items () | 124 | discard_menu_items (void) |
| 126 | { | 125 | { |
| 127 | /* Free the structure if it is especially large. | 126 | /* Free the structure if it is especially large. |
| 128 | Otherwise, hold on to it, to save time. */ | 127 | Otherwise, hold on to it, to save time. */ |
| @@ -145,8 +144,7 @@ cleanup_popup_menu (Lisp_Object arg) | |||
| 145 | mechanism. */ | 144 | mechanism. */ |
| 146 | 145 | ||
| 147 | static Lisp_Object | 146 | static Lisp_Object |
| 148 | restore_menu_items (saved) | 147 | restore_menu_items (Lisp_Object saved) |
| 149 | Lisp_Object saved; | ||
| 150 | { | 148 | { |
| 151 | menu_items = XCAR (saved); | 149 | menu_items = XCAR (saved); |
| 152 | menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil); | 150 | menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil); |
| @@ -164,7 +162,7 @@ restore_menu_items (saved) | |||
| 164 | It will be restored when the specpdl is unwound. */ | 162 | It will be restored when the specpdl is unwound. */ |
| 165 | 163 | ||
| 166 | void | 164 | void |
| 167 | save_menu_items () | 165 | save_menu_items (void) |
| 168 | { | 166 | { |
| 169 | Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil, | 167 | Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil, |
| 170 | make_number (menu_items_used), | 168 | make_number (menu_items_used), |
| @@ -179,7 +177,7 @@ save_menu_items () | |||
| 179 | /* Make the menu_items vector twice as large. */ | 177 | /* Make the menu_items vector twice as large. */ |
| 180 | 178 | ||
| 181 | static void | 179 | static void |
| 182 | grow_menu_items () | 180 | grow_menu_items (void) |
| 183 | { | 181 | { |
| 184 | menu_items_allocated *= 2; | 182 | menu_items_allocated *= 2; |
| 185 | menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); | 183 | menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); |
| @@ -188,7 +186,7 @@ grow_menu_items () | |||
| 188 | /* Begin a submenu. */ | 186 | /* Begin a submenu. */ |
| 189 | 187 | ||
| 190 | static void | 188 | static void |
| 191 | push_submenu_start () | 189 | push_submenu_start (void) |
| 192 | { | 190 | { |
| 193 | if (menu_items_used + 1 > menu_items_allocated) | 191 | if (menu_items_used + 1 > menu_items_allocated) |
| 194 | grow_menu_items (); | 192 | grow_menu_items (); |
| @@ -200,7 +198,7 @@ push_submenu_start () | |||
| 200 | /* End a submenu. */ | 198 | /* End a submenu. */ |
| 201 | 199 | ||
| 202 | static void | 200 | static void |
| 203 | push_submenu_end () | 201 | push_submenu_end (void) |
| 204 | { | 202 | { |
| 205 | if (menu_items_used + 1 > menu_items_allocated) | 203 | if (menu_items_used + 1 > menu_items_allocated) |
| 206 | grow_menu_items (); | 204 | grow_menu_items (); |
| @@ -212,7 +210,7 @@ push_submenu_end () | |||
| 212 | /* Indicate boundary between left and right. */ | 210 | /* Indicate boundary between left and right. */ |
| 213 | 211 | ||
| 214 | static void | 212 | static void |
| 215 | push_left_right_boundary () | 213 | push_left_right_boundary (void) |
| 216 | { | 214 | { |
| 217 | if (menu_items_used + 1 > menu_items_allocated) | 215 | if (menu_items_used + 1 > menu_items_allocated) |
| 218 | grow_menu_items (); | 216 | grow_menu_items (); |
| @@ -224,8 +222,7 @@ push_left_right_boundary () | |||
| 224 | NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */ | 222 | NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */ |
| 225 | 223 | ||
| 226 | static void | 224 | static void |
| 227 | push_menu_pane (name, prefix_vec) | 225 | push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec) |
| 228 | Lisp_Object name, prefix_vec; | ||
| 229 | { | 226 | { |
| 230 | if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) | 227 | if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) |
| 231 | grow_menu_items (); | 228 | grow_menu_items (); |
| @@ -246,8 +243,7 @@ push_menu_pane (name, prefix_vec) | |||
| 246 | item, one of nil, `toggle' or `radio'. */ | 243 | item, one of nil, `toggle' or `radio'. */ |
| 247 | 244 | ||
| 248 | static void | 245 | static void |
| 249 | push_menu_item (name, enable, key, def, equiv, type, selected, help) | 246 | push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help) |
| 250 | Lisp_Object name, enable, key, def, equiv, type, selected, help; | ||
| 251 | { | 247 | { |
| 252 | if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) | 248 | if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) |
| 253 | grow_menu_items (); | 249 | grow_menu_items (); |
| @@ -332,9 +328,7 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object pane_name, | |||
| 332 | If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */ | 328 | If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */ |
| 333 | 329 | ||
| 334 | static void | 330 | static void |
| 335 | single_menu_item (key, item, dummy, skp_v) | 331 | single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *skp_v) |
| 336 | Lisp_Object key, item, dummy; | ||
| 337 | void *skp_v; | ||
| 338 | { | 332 | { |
| 339 | Lisp_Object map, item_string, enabled; | 333 | Lisp_Object map, item_string, enabled; |
| 340 | struct gcpro gcpro1, gcpro2; | 334 | struct gcpro gcpro1, gcpro2; |
| @@ -456,9 +450,7 @@ single_menu_item (key, item, dummy, skp_v) | |||
| 456 | and generate menu panes for them in menu_items. */ | 450 | and generate menu panes for them in menu_items. */ |
| 457 | 451 | ||
| 458 | static void | 452 | static void |
| 459 | keymap_panes (keymaps, nmaps) | 453 | keymap_panes (Lisp_Object *keymaps, int nmaps) |
| 460 | Lisp_Object *keymaps; | ||
| 461 | int nmaps; | ||
| 462 | { | 454 | { |
| 463 | int mapno; | 455 | int mapno; |
| 464 | 456 | ||
| @@ -477,8 +469,7 @@ keymap_panes (keymaps, nmaps) | |||
| 477 | 469 | ||
| 478 | /* Push the items in a single pane defined by the alist PANE. */ | 470 | /* Push the items in a single pane defined by the alist PANE. */ |
| 479 | static void | 471 | static void |
| 480 | list_of_items (pane) | 472 | list_of_items (Lisp_Object pane) |
| 481 | Lisp_Object pane; | ||
| 482 | { | 473 | { |
| 483 | Lisp_Object tail, item, item1; | 474 | Lisp_Object tail, item, item1; |
| 484 | 475 | ||
| @@ -505,8 +496,7 @@ list_of_items (pane) | |||
| 505 | alist-of-alists MENU. | 496 | alist-of-alists MENU. |
| 506 | This handles old-fashioned calls to x-popup-menu. */ | 497 | This handles old-fashioned calls to x-popup-menu. */ |
| 507 | void | 498 | void |
| 508 | list_of_panes (menu) | 499 | list_of_panes (Lisp_Object menu) |
| 509 | Lisp_Object menu; | ||
| 510 | { | 500 | { |
| 511 | Lisp_Object tail; | 501 | Lisp_Object tail; |
| 512 | 502 | ||
| @@ -531,8 +521,7 @@ list_of_panes (menu) | |||
| 531 | whose event type is ITEM_KEY (with string ITEM_NAME) | 521 | whose event type is ITEM_KEY (with string ITEM_NAME) |
| 532 | and whose contents come from the list of keymaps MAPS. */ | 522 | and whose contents come from the list of keymaps MAPS. */ |
| 533 | int | 523 | int |
| 534 | parse_single_submenu (item_key, item_name, maps) | 524 | parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) |
| 535 | Lisp_Object item_key, item_name, maps; | ||
| 536 | { | 525 | { |
| 537 | Lisp_Object length; | 526 | Lisp_Object length; |
| 538 | int len; | 527 | int len; |
| @@ -583,7 +572,7 @@ parse_single_submenu (item_key, item_name, maps) | |||
| 583 | /* Allocate a widget_value, blocking input. */ | 572 | /* Allocate a widget_value, blocking input. */ |
| 584 | 573 | ||
| 585 | widget_value * | 574 | widget_value * |
| 586 | xmalloc_widget_value () | 575 | xmalloc_widget_value (void) |
| 587 | { | 576 | { |
| 588 | widget_value *value; | 577 | widget_value *value; |
| 589 | 578 | ||
| @@ -600,8 +589,7 @@ xmalloc_widget_value () | |||
| 600 | must be left alone. */ | 589 | must be left alone. */ |
| 601 | 590 | ||
| 602 | void | 591 | void |
| 603 | free_menubar_widget_value_tree (wv) | 592 | free_menubar_widget_value_tree (widget_value *wv) |
| 604 | widget_value *wv; | ||
| 605 | { | 593 | { |
| 606 | if (! wv) return; | 594 | if (! wv) return; |
| 607 | 595 | ||
| @@ -627,8 +615,7 @@ free_menubar_widget_value_tree (wv) | |||
| 627 | in menu_items starting at index START, up to index END. */ | 615 | in menu_items starting at index START, up to index END. */ |
| 628 | 616 | ||
| 629 | widget_value * | 617 | widget_value * |
| 630 | digest_single_submenu (start, end, top_level_items) | 618 | digest_single_submenu (int start, int end, int top_level_items) |
| 631 | int start, end, top_level_items; | ||
| 632 | { | 619 | { |
| 633 | widget_value *wv, *prev_wv, *save_wv, *first_wv; | 620 | widget_value *wv, *prev_wv, *save_wv, *first_wv; |
| 634 | int i; | 621 | int i; |
| @@ -856,8 +843,7 @@ digest_single_submenu (start, end, top_level_items) | |||
| 856 | tree is constructed, and small strings are relocated. So we must wait | 843 | tree is constructed, and small strings are relocated. So we must wait |
| 857 | until no GC can happen before storing pointers into lisp values. */ | 844 | until no GC can happen before storing pointers into lisp values. */ |
| 858 | void | 845 | void |
| 859 | update_submenu_strings (first_wv) | 846 | update_submenu_strings (widget_value *first_wv) |
| 860 | widget_value *first_wv; | ||
| 861 | { | 847 | { |
| 862 | widget_value *wv; | 848 | widget_value *wv; |
| 863 | 849 | ||
| @@ -891,11 +877,7 @@ update_submenu_strings (first_wv) | |||
| 891 | VECTOR is an array of menu events for the whole menu. */ | 877 | VECTOR is an array of menu events for the whole menu. */ |
| 892 | 878 | ||
| 893 | void | 879 | void |
| 894 | find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) | 880 | find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data) |
| 895 | FRAME_PTR f; | ||
| 896 | int menu_bar_items_used; | ||
| 897 | Lisp_Object vector; | ||
| 898 | void *client_data; | ||
| 899 | { | 881 | { |
| 900 | Lisp_Object prefix, entry; | 882 | Lisp_Object prefix, entry; |
| 901 | Lisp_Object *subprefix_stack; | 883 | Lisp_Object *subprefix_stack; |
| @@ -1368,7 +1350,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1368 | } | 1350 | } |
| 1369 | 1351 | ||
| 1370 | void | 1352 | void |
| 1371 | syms_of_menu () | 1353 | syms_of_menu (void) |
| 1372 | { | 1354 | { |
| 1373 | staticpro (&menu_items); | 1355 | staticpro (&menu_items); |
| 1374 | menu_items = Qnil; | 1356 | menu_items = Qnil; |