#ifndef TRUE
#define TRUE 1
-#define FALSE 0
#endif /* no TRUE */
-Lisp_Object Qdebug_on_next_call;
+static Lisp_Object Qdebug_on_next_call;
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
const char **);
#endif
-
-static int update_frame_menubar (struct frame *);
\f
/* Flag which when set indicates a dialog or menu has been posted by
Xt on behalf of one of the widget sets. */
/* Wait for an X event to arrive or for a timer to expire. */
+#ifndef USE_MOTIF
+static
+#endif
void
x_menu_wait_for_event (void *data)
{
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;
keyboard events. */
static void
-menu_help_callback (char *help_string, int pane, int item)
+menu_help_callback (char const *help_string, int pane, int item)
{
Lisp_Object *first_item;
Lisp_Object pane_name;
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
- Lisp_Object title, const char **error, EMACS_UINT timestamp)
+ Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
{
Window root;
XMenu *menu;
if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
abort ();
- *error = 0;
+ *error_name = 0;
if (menu_items_n_panes == 0)
return Qnil;
if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
{
- *error = "Empty menu";
+ *error_name = "Empty menu";
return Qnil;
}
menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs");
if (menu == NULL)
{
- *error = "Can't create menu";
+ *error_name = "Can't create menu";
return Qnil;
}
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))
if (lpane == XM_FAILURE)
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
- *error = "Can't create pane";
+ *error_name = "Can't create pane";
return Qnil;
}
i += MENU_ITEMS_PANE_LENGTH;
/* Find the width of the widest item in this pane. */
- maxwidth = 0;
j = i;
while (j < menu_items_used)
{
{
/* Create a new item within current pane. */
Lisp_Object item_name, enable, descrip, help;
- unsigned char *item_data;
- char *help_string;
+ char *item_data;
+ char const *help_string;
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];
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
- help_string = STRINGP (help) ? SDATA (help) : NULL;
+ help_string = STRINGP (help) ? SSDATA (help) : NULL;
if (!NILP (descrip))
{
- int gap = maxwidth - SBYTES (item_name);
/* if alloca is fast, use that to make the space,
to reduce gc needs. */
- item_data
- = (unsigned char *) alloca (maxwidth
- + SBYTES (descrip) + 1);
- memcpy (item_data, SDATA (item_name), SBYTES (item_name));
+ item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
+ memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' ';
- memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
+ memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0;
}
else
- item_data = SDATA (item_name);
+ 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 = "Can't add selection to menu";
+ *error_name = "Can't add selection to menu";
return Qnil;
}
i += MENU_ITEMS_ITEM_LENGTH;
status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
x, y, ButtonReleaseMask, &datap,
menu_help_callback);
+ entry = pane_prefix = Qnil;
switch (status)
{
break;
case XM_FAILURE:
- *error = "Can't activate menu";
+ *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;
}