changeset 6172:57d031171fa2

(map_event_to_object, set_frame_menubar): Use FRAME_MENU_BAR_LINES as vector.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Mar 1994 18:04:59 +0000
parents 7f1756b0b478
children cbf3383981cb
files src/xmenu.c
diffstat 1 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmenu.c	Thu Mar 03 17:43:26 1994 +0000
+++ b/src/xmenu.c	Thu Mar 03 18:04:59 1994 +0000
@@ -793,6 +793,8 @@
 }
 
 
+/* Return the menu bar key which corresponds to event EVENT in frame F.  */
+
 Lisp_Object
 map_event_to_object (event, f)
      struct input_event *event;
@@ -812,11 +814,22 @@
       if (ws && event_is_in_menu_item (mw, event, val->name, &string_w))
 	{
 	  Lisp_Object items;
+	  int i;
+
 	  items = FRAME_MENU_BAR_ITEMS (f);
-	  for (; CONSP (items); items = XCONS (items)->cdr)
-	    if (!strcmp (val->name,
-			XSTRING (Fcar (Fcdr (Fcar (items))))->data))
-	      return items;
+
+	  for (i = 0; i < XVECTOR (items)->size; i += 3)
+	    {
+	      Lisp_Object pos, string, item;
+	      item = XVECTOR (items)->contents[i];
+	      string = XVECTOR (items)->contents[i + 1];
+	      pos = XVECTOR (items)->contents[i + 2];
+	      if (NILP (string))
+		break;
+
+	      if (!strcmp (val->name, XSTRING (string)->data))
+		return item;
+	    }
 	}
     }
   return Qnil;
@@ -920,8 +933,9 @@
 {
   Widget menubar_widget = f->display.x->menubar_widget;
   int id = (int) f;
-  Lisp_Object tail;
+  Lisp_Object tail, items;
   widget_value *wv, *save_wv, *first_wv, *prev_wv = 0;
+  int i;
 
   BLOCK_INPUT;
 
@@ -931,12 +945,15 @@
   wv->enabled = 1;
   save_wv = first_wv = wv;
 
+  items = FRAME_MENU_BAR_ITEMS (f);
 
-  for (tail = FRAME_MENU_BAR_ITEMS (f); CONSP (tail); tail = XCONS (tail)->cdr)
+  for (i = 0; i < XVECTOR (items)->size; i += 3)
     {
       Lisp_Object string;
 
-      string = Fcar (Fcdr (Fcar (tail)));
+      string = XVECTOR (items)->contents[i + 1];
+      if (NILP (string))
+	break;
 
       wv = malloc_widget_value ();
       if (prev_wv)