Lisp_Object Qdebug_on_next_call;
+Lisp_Object Qmenu_alias;
+
extern Lisp_Object Qmenu_enable;
extern Lisp_Object Qmenu_bar;
extern Lisp_Object Qmouse_click, Qevent_kind;
static void list_of_panes ();
static void list_of_items ();
\f
-/* Allocate a widget_value, blocking input. */
-
-widget_value *
-xmalloc_widget_value ()
-{
- widget_value *value;
-
- BLOCK_INPUT;
- value = malloc_widget_value ();
- UNBLOCK_INPUT;
-
- return value;
-}
-\f
/* This holds a Lisp vector that holds the results of decoding
the keymaps or alist-of-alists that specify a menu.
/* If the command is an alias for another
(such as easymenu.el and lmenu.el set it up),
see if the original command name has equivalent keys. */
- if (SYMBOLP (def) && SYMBOLP (XSYMBOL (def)->function))
+ if (SYMBOLP (def) && SYMBOLP (XSYMBOL (def)->function)
+ && ! NILP (Fget (def, Qmenu_alias)))
savedkey = Fwhere_is_internal (XSYMBOL (def)->function,
Qnil, Qt, Qnil);
else
int for_click = 0;
struct gcpro gcpro1;
+#ifdef HAVE_MENUS
if (! NILP (position))
{
check_x ();
xpos += XINT (x);
ypos += XINT (y);
}
+#endif /* HAVE_MENUS */
title = Qnil;
GCPRO1 (title);
return Qnil;
}
+#ifdef HAVE_MENUS
/* Display them in a menu. */
BLOCK_INPUT;
discard_menu_items ();
UNGCPRO;
+#endif /* HAVE_MENUS */
if (error_name) error (error_name);
return selection;
}
+#ifdef HAVE_MENUS
+
DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 2, 0,
"Pop up a dialog box and return user's selection.\n\
POSITION specifies which frame to use.\n\
popup_activated_flag = 0;
}
+/* Allocate a widget_value, blocking input. */
+
+widget_value *
+xmalloc_widget_value ()
+{
+ widget_value *value;
+
+ BLOCK_INPUT;
+ value = malloc_widget_value ();
+ UNBLOCK_INPUT;
+
+ return value;
+}
/* This recursively calls free_widget_value on the tree of widgets.
It must free all data that was malloc'ed for these widget_values.
But don't make a pane that is empty--ignore that map instead. */
for (i = 0; i < len; i++)
{
- if (SYMBOLP (mapvec[i]))
+ if (SYMBOLP (mapvec[i])
+ || (CONSP (mapvec[i])
+ && NILP (Fkeymapp (mapvec[i]))))
{
+ /* Here we have a command at top level in the menu bar
+ as opposed to a submenu. */
top_level_items = 1;
push_menu_pane (Qnil, Qnil);
push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil);
menu_items = f->menu_bar_vector;
menu_items_allocated = XVECTOR (menu_items)->size;
init_menu_items ();
- for (i = 0; i < XVECTOR (items)->size; i += 3)
+ for (i = 0; i < XVECTOR (items)->size; i += 4)
{
Lisp_Object key, string, maps;
/* Now GC cannot happen during the lifetime of the widget_value,
so it's safe to store data from a Lisp_String. */
wv = first_wv->contents;
- for (i = 0; i < XVECTOR (items)->size; i += 3)
+ for (i = 0; i < XVECTOR (items)->size; i += 4)
{
Lisp_Object string;
string = XVECTOR (items)->contents[i + 1];
just the top level menu bar strings. */
items = FRAME_MENU_BAR_ITEMS (f);
- for (i = 0; i < XVECTOR (items)->size; i += 3)
+ for (i = 0; i < XVECTOR (items)->size; i += 4)
{
Lisp_Object string;
}
#endif /* not USE_X_TOOLKIT */
+
+#endif /* HAVE_MENUS */
\f
syms_of_xmenu ()
{
staticpro (&menu_items);
menu_items = Qnil;
+ Qmenu_alias = intern ("menu-alias");
+ staticpro (&Qmenu_alias);
+
Qdebug_on_next_call = intern ("debug-on-next-call");
staticpro (&Qdebug_on_next_call);
#endif
defsubr (&Sx_popup_menu);
+#ifdef HAVE_MENUS
defsubr (&Sx_popup_dialog);
+#endif
}