diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2004-08-31 16:31:03 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2004-08-31 16:31:03 +0000 |
commit | 8328a03d0cf23b4851e22e3c45d4d24106916766 (patch) | |
tree | 8c8f6f0a95f6fbc5b677193e936c31834e800bef /src/xmenu.c | |
parent | bfe3b03c6a537ffbdfa25e3b16acd40ae6a833ef (diff) | |
parent | 2aa2f8b8c979787390f8ebf6ebe22fa81bbe7c06 (diff) | |
download | emacs-8328a03d0cf23b4851e22e3c45d4d24106916766.tar.gz |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-509
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-510
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-511
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-512
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-513
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-514
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-515
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-516
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-517
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-518
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-239
Diffstat (limited to 'src/xmenu.c')
-rw-r--r-- | src/xmenu.c | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 2ca6e247e12..aa963935262 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1701,12 +1701,9 @@ digest_single_submenu (start, end, top_level_items) save_wv->next = wv; else first_wv->contents = wv; - wv->name = pane_string; - /* Ignore the @ that means "separate pane". - This is a kludge, but this isn't worth more time. */ - if (!NILP (prefix) && wv->name[0] == '@') - wv->name++; - wv->value = 0; + wv->lname = pane_name; + /* Set value to 1 so update_submenu_strings can handle '@' */ + wv->value = (char *)1; wv->enabled = 1; wv->button_type = BUTTON_TYPE_NONE; wv->help = Qnil; @@ -1749,9 +1746,9 @@ digest_single_submenu (start, end, top_level_items) else save_wv->contents = wv; - wv->name = (char *) SDATA (item_name); + wv->lname = item_name; if (!NILP (descrip)) - wv->key = (char *) SDATA (descrip); + wv->lkey = descrip; wv->value = 0; /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -1790,6 +1787,42 @@ digest_single_submenu (start, end, top_level_items) return first_wv; } + +/* Walk through the widget_value tree starting at FIRST_WV and update + the char * pointers from the corresponding lisp values. + We do this after building the whole tree, since GC may happen while the + tree is constructed, and small strings are relocated. So we must wait + until no GC can happen before storing pointers into lisp values. */ +static void +update_submenu_strings (first_wv) + widget_value *first_wv; +{ + widget_value *wv; + + for (wv = first_wv; wv; wv = wv->next) + { + if (wv->lname && ! NILP (wv->lname)) + { + wv->name = SDATA (wv->lname); + + /* Ignore the @ that means "separate pane". + This is a kludge, but this isn't worth more time. */ + if (wv->value == (char *)1) + { + if (wv->name[0] == '@') + wv->name++; + wv->value = 0; + } + } + + if (wv->lkey && ! NILP (wv->lkey)) + wv->key = SDATA (wv->lkey); + + if (wv->contents) + update_submenu_strings (wv->contents); + } +} + /* Recompute all the widgets of frame F, when the menu bar has been changed. Value is non-zero if widgets were updated. */ @@ -2022,9 +2055,10 @@ set_frame_menubar (f, first_time, deep_p) Lisp_Object string; string = XVECTOR (items)->contents[i + 1]; if (NILP (string)) - break; - wv->name = (char *) SDATA (string); - wv = wv->next; + break; + wv->name = (char *) SDATA (string); + update_submenu_strings (wv->contents); + wv = wv->next; } f->menu_bar_vector = menu_items; |