\f
/* This is a subroutine of single_keymap_panes that handles one
keymap entry.
- KEY is a key in a keymap and ITEM is its binding.
+ KEY is a key in a keymap and ITEM is its binding.
PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
separate panes.
If NOTREAL is nonzero, only check for equivalent key bindings, don't
Lisp_Object map, item_string, enabled;
struct gcpro gcpro1, gcpro2;
int res;
-
+
/* Parse the menu item and leave the result in item_properties. */
GCPRO2 (key, item);
res = parse_menu_item (item, notreal, 0);
return; /* Not a menu item. */
map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
-
+
if (notreal)
{
/* We don't want to make a menu, just traverse the keymaps to
}
enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
- item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
+ item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
if (!NILP (map) && XSTRING (item_string)->data[0] == '@')
{
item_string = concat2 (prefix, item_string);
}
#endif /* not HAVE_BOXES */
-
+
#ifndef USE_X_TOOLKIT
if (!NILP(map))
/* Indicate visually that this is a submenu. */
Lisp_Object keymap, tem;
int xpos = 0, ypos = 0;
Lisp_Object title;
- char *error_name;
+ char *error_name = NULL;
Lisp_Object selection;
struct frame *f = NULL;
Lisp_Object x, y, window;
keymaps = 0;
}
-
+
if (NILP (position))
{
discard_menu_items ();
XEvent event;
struct event_queue *next;
};
-
+
struct event_queue *queue = NULL;
struct event_queue *queue_tmp;
{
dpyinfo->grabbed &= ~(1 << event.xbutton.button);
popup_activated_flag = 0;
-#ifdef USE_MOTIF /* Pretending that the event came from a
+#ifdef USE_MOTIF /* Pretending that the event came from a
Btn1Down seems the only way to convince Motif to
activate its callbacks; setting the XmNmenuPost
isn't working. --marcus@sysc.pdx.edu. */
}
/* Unread any events that we got but did not handle. */
- while (queue != NULL)
+ while (queue != NULL)
{
queue_tmp = queue;
XPutBackEvent (queue_tmp->event.xany.display, &queue_tmp->event);
The reason for saving the button event until here, instead of
passing it to the toolkit right away, is that we can safely
execute Lisp code. */
-
+
void
x_activate_menubar (f)
FRAME_PTR f;
if (f->output_data.x->saved_menu_event->type == ButtonRelease)
pending_menu_activation = 1;
#endif
-
+
/* Ignore this if we get it a second time. */
f->output_data.x->saved_menu_event->type = 0;
}
Lisp_Object frame, help;
help = wv && wv->help ? build_string (wv->help) : Qnil;
-
+
/* Determine the frame for the help event. */
f = menubar_id_to_frame (id);
if (f)
}
else
{
- /* WIDGET is the popup menu. It's parent is the frame's
+ /* WIDGET is the popup menu. It's parent is the frame's
widget. See which frame that is. */
Widget frame_widget = XtParent (widget);
Lisp_Object tail;
first_wv = wv;
save_wv = 0;
prev_wv = 0;
-
+
/* Loop over all panes and items made during this call
and construct a tree of widget_value objects.
Ignore the panes and items made by previous calls to
/* Create a new pane. */
Lisp_Object pane_name, prefix;
char *pane_string;
-
+
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
-
+
#ifndef HAVE_MULTILINGUAL_MENU
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
{
/* Create a new item within current pane. */
Lisp_Object item_name, enable, descrip, def, type, selected;
Lisp_Object help;
-
+
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
item_name = string_make_unibyte (item_name);
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
}
-
+
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
{
descrip = string_make_unibyte (descrip);
#endif /* not HAVE_MULTILINGUAL_MENU */
wv = xmalloc_widget_value ();
- if (prev_wv)
+ if (prev_wv)
prev_wv->next = wv;
else
save_wv->contents = wv;
as long as pointers have enough bits to hold small integers. */
wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
wv->enabled = !NILP (enable);
-
+
if (NILP (type))
wv->button_type = BUTTON_TYPE_NONE;
else if (EQ (type, QCradio))
wv->selected = !NILP (selected);
if (STRINGP (help))
wv->help = XSTRING (help)->data;
-
+
prev_wv = wv;
i += MENU_ITEMS_ITEM_LENGTH;
{
struct x_output *x = f->output_data.x;
int columns, rows;
-
+
if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
return 0;
/* Run the Lucid hook. */
safe_run_hooks (Qactivate_menubar_hook);
-
+
/* If it has changed current-menubar from previous value,
really recompute the menubar from the value. */
if (! NILP (Vlucid_menu_bar_dirty_flag))
break;
wv = single_submenu (key, string, maps);
- if (prev_wv)
+ if (prev_wv)
prev_wv->next = wv;
else
first_wv->contents = wv;
This value just has to be different from small integers. */
wv->call_data = (void *) (EMACS_INT) (-1);
- if (prev_wv)
+ if (prev_wv)
prev_wv->next = wv;
else
first_wv->contents = wv;
}
else
{
- menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
+ menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
f->output_data.x->column_widget,
0,
popup_activate_callback,
}
{
- int menubar_size
+ int menubar_size
= (f->output_data.x->menubar_widget
? (f->output_data.x->menubar_widget->core.height
+ f->output_data.x->menubar_widget->core.border_width)
f->output_data.x->menubar_height = menubar_size;
}
-
+
free_menubar_widget_value_tree (first_wv);
update_frame_menubar (f);
menubar_widget = f->output_data.x->menubar_widget;
f->output_data.x->menubar_height = 0;
-
+
if (menubar_widget)
{
#ifdef USE_MOTIF
is switched off, which fixes the shell position. */
Position x0, y0, x1, y1;
#endif
-
+
BLOCK_INPUT;
#ifdef USE_MOTIF
if (f->output_data.x->widget)
XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL);
#endif
-
+
lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
f->output_data.x->menubar_widget = NULL;
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
}
#endif
-
+
UNBLOCK_INPUT;
}
}
wv->button_type = BUTTON_TYPE_NONE;
first_wv = wv;
first_pane = 1;
-
+
/* Loop over all panes and items, filling in the tree. */
i = 0;
while (i < menu_items_used)
/* Create a new pane. */
Lisp_Object pane_name, prefix;
char *pane_string;
-
+
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
-
+
#ifndef HAVE_MULTILINGUAL_MENU
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
{
item_name = string_make_unibyte (item_name);
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
}
-
+
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
{
descrip = string_make_unibyte (descrip);
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
}
#endif /* not HAVE_MULTILINGUAL_MENU */
-
+
wv = xmalloc_widget_value ();
- if (prev_wv)
+ if (prev_wv)
prev_wv->next = wv;
- else
+ else
save_wv->contents = wv;
wv->name = (char *) XSTRING (item_name)->data;
if (!NILP (descrip))
wv->selected = !NILP (selected);
if (STRINGP (help))
wv->help = XSTRING (help)->data;
-
+
prev_wv = wv;
i += MENU_ITEMS_ITEM_LENGTH;
if (STRING_MULTIBYTE (title))
title = string_make_unibyte (title);
#endif
-
+
wv_title->name = (char *) XSTRING (title)->data;
wv_title->enabled = True;
wv_title->button_type = BUTTON_TYPE_NONE;
that it is unnecessary--that the menu has already disappeared.
Nowadays the menu disappears ok, all right, but
we need to delete the widgets or multiple ones will pile up. */
- lw_destroy_all_widgets (menu_id);
+ lw_destroy_all_widgets (menu_id);
/* Find the selected item, and its pane, to return
the proper value. */
pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
pane_string = (NILP (pane_name)
- ? "" : (char *) XSTRING (pane_name)->data);
+ ? "" : (char *) XSTRING (pane_name)->data);
prev_wv = xmalloc_widget_value ();
prev_wv->value = pane_string;
if (keymaps && !NILP (prefix))
prev_wv->enabled = 1;
prev_wv->name = "message";
first_wv = prev_wv;
-
+
/* Loop over all panes and items, filling in the tree. */
i = MENU_ITEMS_PANE_LENGTH;
while (i < menu_items_used)
{
-
+
/* Create a new item within current pane. */
Lisp_Object item_name, enable, descrip;
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
descrip
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
-
+
if (NILP (item_name))
{
free_menubar_widget_value_tree (first_wv);
/* Process events that apply to the menu. */
popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);
- lw_destroy_all_widgets (dialog_id);
+ lw_destroy_all_widgets (dialog_id);
/* Find the selected item, and its pane, to return
the proper value. */
PANE is the pane number, and ITEM is the menu item number in
the menu (currently not used).
-
+
This cannot be done with generating a HELP_EVENT because
XMenuActivate contains a loop that doesn't let Emacs process
keyboard events. */
Lisp_Object *first_item;
Lisp_Object pane_name;
Lisp_Object menu_object;
-
+
first_item = XVECTOR (menu_items)->contents;
if (EQ (first_item[0], Qt))
pane_name = first_item[MENU_ITEMS_PANE_NAME];
pane_name = build_string ("");
else
pane_name = first_item[MENU_ITEMS_ITEM_NAME];
-
+
/* (menu-item MENU-NAME PANE-NUMBER) */
menu_object = Fcons (Qmenu_item,
Fcons (pane_name,
show_help_echo (help_string ? build_string (help_string) : Qnil,
Qnil, menu_object, make_number (item), 1);
}
-
+
static Lisp_Object
xmenu_show (f, x, y, for_click, keymaps, title, error)
Lisp_Object title;
char **error;
{
- Window root;
+ Window root;
XMenu *menu;
int pane, selidx, lpane, status;
Lisp_Object entry, pane_prefix;
/* Adjust coordinates to be root-window-relative. */
x += f->output_data.x->left_pos;
y += f->output_data.x->top_pos;
-
+
/* Create all the necessary panes and their items. */
i = 0;
while (i < menu_items_used)
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
help_string = STRINGP (help) ? XSTRING (help)->data : NULL;
-
+
if (!NILP (descrip))
{
int gap = maxwidth - STRING_BYTES (XSTRING (item_name));
Vmenu_updating_frame = Qnil;
#ifdef USE_X_TOOLKIT
- widget_id_tick = (1<<16);
+ widget_id_tick = (1<<16);
next_menubar_widget_id = 1;
#endif