aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-25 22:22:31 +0000
committerRichard M. Stallman1994-04-25 22:22:31 +0000
commitf5e09c8b1b15167937acff84e6294d51ffce12c3 (patch)
tree3b83f67340b5c50c71a742a28fbe4dc1b9a48229 /src
parent765a05bceff73b019fe749453e7df8d1c42cb6a4 (diff)
downloademacs-f5e09c8b1b15167937acff84e6294d51ffce12c3.tar.gz
emacs-f5e09c8b1b15167937acff84e6294d51ffce12c3.zip
(menu_bar_item): Put a list of keymaps into the third
slot of an item in menu_bar_items_vector. (kbd_buffer_get_event): Handle menu_bar_event.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 0c025d6b624..a7900c85c43 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2008,6 +2008,12 @@ kbd_buffer_get_event ()
2008 kbd_fetch_ptr = event + 1; 2008 kbd_fetch_ptr = event + 1;
2009 } 2009 }
2010#endif 2010#endif
2011 else if (event->kind == menu_bar_event)
2012 {
2013 /* The event value is in the frame_or_window slot. */
2014 obj = event->frame_or_window;
2015 kbd_fetch_ptr = event + 1;
2016 }
2011 else if (event->kind == buffer_switch_event) 2017 else if (event->kind == buffer_switch_event)
2012 { 2018 {
2013 /* The value doesn't matter here; only the type is tested. */ 2019 /* The value doesn't matter here; only the type is tested. */
@@ -3507,7 +3513,7 @@ static Lisp_Object menu_bar_items_index;
3507 3513
3508/* Return a vector of menu items for a menu bar, appropriate 3514/* Return a vector of menu items for a menu bar, appropriate
3509 to the current buffer. Each item has three elements in the vector: 3515 to the current buffer. Each item has three elements in the vector:
3510 KEY STRING nil. 3516 KEY STRING MAPLIST.
3511 3517
3512 OLD is an old vector we can optionally reuse, or nil. */ 3518 OLD is an old vector we can optionally reuse, or nil. */
3513 3519
@@ -3645,9 +3651,7 @@ menu_bar_items (old)
3645} 3651}
3646 3652
3647/* Scan one map KEYMAP, accumulating any menu items it defines 3653/* Scan one map KEYMAP, accumulating any menu items it defines
3648 that have not yet been seen in RESULT. Return the updated RESULT. 3654 in menu_bar_items_vector. */
3649 *OLD is the frame's old menu bar list; we swipe elts from that
3650 to avoid consing. */
3651 3655
3652static void 3656static void
3653menu_bar_one_keymap (keymap) 3657menu_bar_one_keymap (keymap)
@@ -3704,6 +3708,9 @@ menu_bar_item_1 (arg)
3704 return Qnil; 3708 return Qnil;
3705} 3709}
3706 3710
3711/* Add one item to menu_bar_items_vector, for KEY, ITEM_STRING and DEF.
3712 If there's already an item for KEY, add this DEF to it. */
3713
3707static void 3714static void
3708menu_bar_item (key, item_string, def) 3715menu_bar_item (key, item_string, def)
3709 Lisp_Object key, item_string, def; 3716 Lisp_Object key, item_string, def;
@@ -3714,7 +3721,7 @@ menu_bar_item (key, item_string, def)
3714 3721
3715 if (EQ (def, Qundefined)) 3722 if (EQ (def, Qundefined))
3716 { 3723 {
3717 /* If a map has an explicit nil as definition, 3724 /* If a map has an explicit `undefined' as definition,
3718 discard any previously made menu bar item. */ 3725 discard any previously made menu bar item. */
3719 3726
3720 for (i = 0; i < menu_bar_items_index; i += 3) 3727 for (i = 0; i < menu_bar_items_index; i += 3)
@@ -3748,12 +3755,12 @@ menu_bar_item (key, item_string, def)
3748 if (NILP (enabled)) 3755 if (NILP (enabled))
3749 return; 3756 return;
3750 3757
3751 /* If there's already such an item, don't make another. */ 3758 /* Find any existing item for this KEY. */
3752 for (i = 0; i < menu_bar_items_index; i += 3) 3759 for (i = 0; i < menu_bar_items_index; i += 3)
3753 if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i])) 3760 if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
3754 break; 3761 break;
3755 3762
3756 /* If we did not find this item, add it at the end. */ 3763 /* If we did not find this KEY, add it at the end. */
3757 if (i == menu_bar_items_index) 3764 if (i == menu_bar_items_index)
3758 { 3765 {
3759 /* If vector is too small, get a bigger one. */ 3766 /* If vector is too small, get a bigger one. */
@@ -3769,9 +3776,16 @@ menu_bar_item (key, item_string, def)
3769 /* Add this item. */ 3776 /* Add this item. */
3770 XVECTOR (menu_bar_items_vector)->contents[i++] = key; 3777 XVECTOR (menu_bar_items_vector)->contents[i++] = key;
3771 XVECTOR (menu_bar_items_vector)->contents[i++] = item_string; 3778 XVECTOR (menu_bar_items_vector)->contents[i++] = item_string;
3772 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 3779 XVECTOR (menu_bar_items_vector)->contents[i++] = Fcons (def, Qnil);
3773 menu_bar_items_index = i; 3780 menu_bar_items_index = i;
3774 } 3781 }
3782 /* We did find an item for this KEY. Add DEF to its list of maps. */
3783 else
3784 {
3785 Lisp_Object old;
3786 old = XVECTOR (menu_bar_items_vector)->contents[i + 2];
3787 XVECTOR (menu_bar_items_vector)->contents[i + 2] = Fcons (def, old);
3788 }
3775} 3789}
3776 3790
3777/* Read a character using menus based on maps in the array MAPS. 3791/* Read a character using menus based on maps in the array MAPS.