widget_value *wv = (widget_value *) get_opaque_ptr (closure);
free_opaque_ptr (closure);
if (wv)
- free_widget_value (wv);
+ free_widget_value_tree (wv);
return Qnil;
}
if (! wv) return;
if (wv->key) xfree (wv->key);
if (wv->value) xfree (wv->value);
+ if (wv->name) xfree (wv->name);
wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
Lisp_Object fn, arg;
Lisp_Object data;
Lisp_Object frame;
+ int update_subwindows_p = 0;
struct device *d = get_device_from_display (XtDisplay (widget));
struct frame *f = x_any_widget_or_parent_to_frame (d, widget);
}
else
{
- MARK_SUBWINDOWS_STATE_CHANGED;
+ update_subwindows_p = 1;
get_gui_callback (data, &fn, &arg);
}
DEVICE_X_MOUSE_TIMESTAMP (d) = DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (d);
#endif
signal_special_Xt_user_event (frame, fn, arg);
+ /* The result of this evaluation could cause other instances to change so
+ enqueue an update callback to check this. */
+ if (update_subwindows_p)
+ signal_special_Xt_user_event (frame, Qeval,
+ list2 (Qupdate_widget_instances, frame));
}
#if 1
#endif
char *
-menu_separator_style (CONST char *s)
+menu_separator_style (const char *s)
{
- CONST char *p;
+ const char *p;
char first;
if (!s || s[0] == '\0')
return NULL;
}
+char *
+strdup_and_add_accel (char *name)
+{
+ int i;
+ int found_accel = 0;
+
+ for (i=0; name[i]; ++i)
+ if (name[i] == '%' && name[i+1] == '_')
+ {
+ found_accel = 1;
+ break;
+ }
+
+ if (found_accel)
+ return xstrdup (name);
+ else
+ {
+ char *chars = (char *) alloca (strlen (name) + 3);
+ chars[0] = '%';
+ chars[1] = '_';
+ memcpy (chars+2, name, strlen (name) + 1);
+ return xstrdup (chars);
+ }
+}
/* This does the dirty work. gc_currently_forbidden is 1 when this is called.
*/
/* !!#### This function has not been Mule-ized */
/* This function cannot GC because gc_currently_forbidden is set when
it's called */
- struct Lisp_Gui_Item* pgui = 0;
+ Lisp_Gui_Item* pgui = 0;
/* degenerate case */
if (STRINGP (gui_item))
{
wv->type = TEXT_TYPE;
wv->name = (char *) XSTRING_DATA (gui_item);
- wv->name = xstrdup (wv->name);
+ wv->name = strdup_and_add_accel (wv->name);
return 1;
}
else if (!GUI_ITEMP (gui_item))
}
#endif /* HAVE_MENUBARS */
+ if (!STRINGP (pgui->name))
+ pgui->name = Feval (pgui->name);
+
CHECK_STRING (pgui->name);
wv->name = (char *) XSTRING_DATA (pgui->name);
wv->name = xstrdup (wv->name);
if (!NILP (pgui->suffix))
{
- CONST char *const_bogosity;
+ const char *const_bogosity;
Lisp_Object suffix2;
/* Shortcut to avoid evaluating suffix each time */
CHECK_STRING (suffix2);
}
- GET_C_STRING_FILENAME_DATA_ALLOCA (suffix2, const_bogosity);
+ TO_EXTERNAL_FORMAT (LISP_STRING, suffix2,
+ C_STRING_ALLOCA, const_bogosity,
+ Qfile_name);
wv->value = (char *) const_bogosity;
wv->value = xstrdup (wv->value);
}
}
else if (SYMBOLP (pgui->callback)) /* Show the binding of this command. */
{
- char buf [1024];
+ char buf[1024]; /* #### */
/* #### Warning, dependency here on current_buffer and point */
where_is_to_char (pgui->callback, buf);
if (buf [0])
wv = xmalloc_widget_value();
if (parent)
parent->contents = wv;
- else
+ else
prev->next = wv;
if (!button_item_to_widget_value (items, wv, 0, 1))
{
- free_widget_value (wv);
+ free_widget_value_tree (wv);
if (parent)
parent->contents = 0;
- else
+ else
prev->next = 0;
}
- else
+ else
{
wv->value = xstrdup (wv->name); /* what a mess... */
}
control = control->contents;
tmp->next = 0;
tmp->contents = 0;
- free_widget_value (tmp);
+ free_widget_value_tree (tmp);
/* No more need to free the half-filled-in structures. */
set_opaque_ptr (wv_closure, 0);
void
syms_of_gui_x (void)
{
+ INIT_LRECORD_IMPLEMENTATION (popup_data);
+
defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook");
}