aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-08-31 16:31:03 +0000
committerKaroly Lorentey2004-08-31 16:31:03 +0000
commit8328a03d0cf23b4851e22e3c45d4d24106916766 (patch)
tree8c8f6f0a95f6fbc5b677193e936c31834e800bef /src/xmenu.c
parentbfe3b03c6a537ffbdfa25e3b16acd40ae6a833ef (diff)
parent2aa2f8b8c979787390f8ebf6ebe22fa81bbe7c06 (diff)
downloademacs-8328a03d0cf23b4851e22e3c45d4d24106916766.tar.gz
emacs-8328a03d0cf23b4851e22e3c45d4d24106916766.zip
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.c56
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)
1701 save_wv->next = wv; 1701 save_wv->next = wv;
1702 else 1702 else
1703 first_wv->contents = wv; 1703 first_wv->contents = wv;
1704 wv->name = pane_string; 1704 wv->lname = pane_name;
1705 /* Ignore the @ that means "separate pane". 1705 /* Set value to 1 so update_submenu_strings can handle '@' */
1706 This is a kludge, but this isn't worth more time. */ 1706 wv->value = (char *)1;
1707 if (!NILP (prefix) && wv->name[0] == '@')
1708 wv->name++;
1709 wv->value = 0;
1710 wv->enabled = 1; 1707 wv->enabled = 1;
1711 wv->button_type = BUTTON_TYPE_NONE; 1708 wv->button_type = BUTTON_TYPE_NONE;
1712 wv->help = Qnil; 1709 wv->help = Qnil;
@@ -1749,9 +1746,9 @@ digest_single_submenu (start, end, top_level_items)
1749 else 1746 else
1750 save_wv->contents = wv; 1747 save_wv->contents = wv;
1751 1748
1752 wv->name = (char *) SDATA (item_name); 1749 wv->lname = item_name;
1753 if (!NILP (descrip)) 1750 if (!NILP (descrip))
1754 wv->key = (char *) SDATA (descrip); 1751 wv->lkey = descrip;
1755 wv->value = 0; 1752 wv->value = 0;
1756 /* The EMACS_INT cast avoids a warning. There's no problem 1753 /* The EMACS_INT cast avoids a warning. There's no problem
1757 as long as pointers have enough bits to hold small integers. */ 1754 as long as pointers have enough bits to hold small integers. */
@@ -1790,6 +1787,42 @@ digest_single_submenu (start, end, top_level_items)
1790 1787
1791 return first_wv; 1788 return first_wv;
1792} 1789}
1790
1791/* Walk through the widget_value tree starting at FIRST_WV and update
1792 the char * pointers from the corresponding lisp values.
1793 We do this after building the whole tree, since GC may happen while the
1794 tree is constructed, and small strings are relocated. So we must wait
1795 until no GC can happen before storing pointers into lisp values. */
1796static void
1797update_submenu_strings (first_wv)
1798 widget_value *first_wv;
1799{
1800 widget_value *wv;
1801
1802 for (wv = first_wv; wv; wv = wv->next)
1803 {
1804 if (wv->lname && ! NILP (wv->lname))
1805 {
1806 wv->name = SDATA (wv->lname);
1807
1808 /* Ignore the @ that means "separate pane".
1809 This is a kludge, but this isn't worth more time. */
1810 if (wv->value == (char *)1)
1811 {
1812 if (wv->name[0] == '@')
1813 wv->name++;
1814 wv->value = 0;
1815 }
1816 }
1817
1818 if (wv->lkey && ! NILP (wv->lkey))
1819 wv->key = SDATA (wv->lkey);
1820
1821 if (wv->contents)
1822 update_submenu_strings (wv->contents);
1823 }
1824}
1825
1793 1826
1794/* Recompute all the widgets of frame F, when the menu bar has been 1827/* Recompute all the widgets of frame F, when the menu bar has been
1795 changed. Value is non-zero if widgets were updated. */ 1828 changed. Value is non-zero if widgets were updated. */
@@ -2022,9 +2055,10 @@ set_frame_menubar (f, first_time, deep_p)
2022 Lisp_Object string; 2055 Lisp_Object string;
2023 string = XVECTOR (items)->contents[i + 1]; 2056 string = XVECTOR (items)->contents[i + 1];
2024 if (NILP (string)) 2057 if (NILP (string))
2025 break; 2058 break;
2026 wv->name = (char *) SDATA (string); 2059 wv->name = (char *) SDATA (string);
2027 wv = wv->next; 2060 update_submenu_strings (wv->contents);
2061 wv = wv->next;
2028 } 2062 }
2029 2063
2030 f->menu_bar_vector = menu_items; 2064 f->menu_bar_vector = menu_items;