menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
- subitems = XVECTOR (items)->size / 4;
+ subitems = XVECTOR_SIZE (items) / 4;
submenu_start = (int *) alloca (subitems * sizeof (int *));
submenu_end = (int *) alloca (subitems * sizeof (int *));
submenu_n_panes = (int *) alloca (subitems * sizeof (int));
/* 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 += 4)
+ for (i = 0; i < XVECTOR_SIZE (items); i += 4)
{
Lisp_Object string;
string = XVECTOR (items)->contents[i + 1];
first_wv = wv;
items = FRAME_MENU_BAR_ITEMS (f);
- for (i = 0; i < XVECTOR (items)->size; i += 4)
+ for (i = 0; i < XVECTOR_SIZE (items); i += 4)
{
Lisp_Object string;
y += f->top_pos;
/* Create all the necessary panes and their items. */
- maxlines = lines = i = 0;
+ maxwidth = maxlines = lines = i = 0;
+ lpane = XM_FAILURE;
while (i < menu_items_used)
{
if (EQ (XVECTOR (menu_items)->contents[i], Qt))
i += MENU_ITEMS_PANE_LENGTH;
/* Find the width of the widest item in this pane. */
- maxwidth = 0;
j = i;
while (j < menu_items_used)
{
else
item_data = SSDATA (item_name);
- if (XMenuAddSelection (FRAME_X_DISPLAY (f),
- menu, lpane, 0, item_data,
- !NILP (enable), help_string)
- == XM_FAILURE)
+ if (lpane == XM_FAILURE
+ || (XMenuAddSelection (FRAME_X_DISPLAY (f),
+ menu, lpane, 0, item_data,
+ !NILP (enable), help_string)
+ == XM_FAILURE))
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
*error_name = "Can't add selection to menu";
status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
x, y, ButtonReleaseMask, &datap,
menu_help_callback);
+ entry = pane_prefix = Qnil;
switch (status)
{
case XM_FAILURE:
*error_name = "Can't activate menu";
case XM_IA_SELECT:
- entry = Qnil;
break;
case XM_NO_SELECT:
/* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
the menu was invoked with a mouse event as POSITION). */
if (! for_click)
Fsignal (Qquit, Qnil);
- entry = Qnil;
break;
}