* xmenu.c (digest_single_submenu): Set lname and lkey in widget_value
instead of name and key. (update_submenu_strings): New function. (set_frame_menubar): Remove call to inhibit_garbage_collection, call update_submenu_strings. Call ENCODE_MENU_STRING for top level menu names. * gtkutil.h (_widget_value): Added lname and lkey.
This commit is contained in:
parent
05bdae441b
commit
2bf436c3bb
3 changed files with 59 additions and 13 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2004-08-30 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
|
||||||
|
|
||||||
|
* xmenu.c (digest_single_submenu): Set lname and lkey in widget_value
|
||||||
|
instead of name and key.
|
||||||
|
(update_submenu_strings): New function.
|
||||||
|
(set_frame_menubar): Remove call to inhibit_garbage_collection,
|
||||||
|
call update_submenu_strings. Call ENCODE_MENU_STRING for top level
|
||||||
|
menu names.
|
||||||
|
|
||||||
|
* gtkutil.h (_widget_value): Added lname and lkey.
|
||||||
|
|
||||||
2004-08-30 Steven Tamm <steventamm@mac.com>
|
2004-08-30 Steven Tamm <steventamm@mac.com>
|
||||||
|
|
||||||
* macmenu.c (mac_menu_show): Remove shadowing of menu variable
|
* macmenu.c (mac_menu_show): Remove shadowing of menu variable
|
||||||
|
|
|
@ -96,10 +96,12 @@ typedef struct xg_menu_item_cb_data_
|
||||||
typedef struct _widget_value
|
typedef struct _widget_value
|
||||||
{
|
{
|
||||||
/* name of widget */
|
/* name of widget */
|
||||||
|
Lisp_Object lname;
|
||||||
char *name;
|
char *name;
|
||||||
/* value (meaning depend on widget type) */
|
/* value (meaning depend on widget type) */
|
||||||
char *value;
|
char *value;
|
||||||
/* keyboard equivalent. no implications for XtTranslations */
|
/* keyboard equivalent. no implications for XtTranslations */
|
||||||
|
Lisp_Object lkey;
|
||||||
char *key;
|
char *key;
|
||||||
/* Help string or nil if none.
|
/* Help string or nil if none.
|
||||||
GC finds this string through the frame's menu_bar_vector
|
GC finds this string through the frame's menu_bar_vector
|
||||||
|
|
59
src/xmenu.c
59
src/xmenu.c
|
@ -1701,12 +1701,9 @@ digest_single_submenu (start, end, top_level_items)
|
||||||
save_wv->next = wv;
|
save_wv->next = wv;
|
||||||
else
|
else
|
||||||
first_wv->contents = wv;
|
first_wv->contents = wv;
|
||||||
wv->name = pane_string;
|
wv->lname = pane_name;
|
||||||
/* Ignore the @ that means "separate pane".
|
/* Set value to 1 so update_submenu_strings can handle '@' */
|
||||||
This is a kludge, but this isn't worth more time. */
|
wv->value = (char *)1;
|
||||||
if (!NILP (prefix) && wv->name[0] == '@')
|
|
||||||
wv->name++;
|
|
||||||
wv->value = 0;
|
|
||||||
wv->enabled = 1;
|
wv->enabled = 1;
|
||||||
wv->button_type = BUTTON_TYPE_NONE;
|
wv->button_type = BUTTON_TYPE_NONE;
|
||||||
wv->help = Qnil;
|
wv->help = Qnil;
|
||||||
|
@ -1749,9 +1746,9 @@ digest_single_submenu (start, end, top_level_items)
|
||||||
else
|
else
|
||||||
save_wv->contents = wv;
|
save_wv->contents = wv;
|
||||||
|
|
||||||
wv->name = (char *) SDATA (item_name);
|
wv->lname = item_name;
|
||||||
if (!NILP (descrip))
|
if (!NILP (descrip))
|
||||||
wv->key = (char *) SDATA (descrip);
|
wv->lkey = descrip;
|
||||||
wv->value = 0;
|
wv->value = 0;
|
||||||
/* The EMACS_INT cast avoids a warning. There's no problem
|
/* The EMACS_INT cast avoids a warning. There's no problem
|
||||||
as long as pointers have enough bits to hold small integers. */
|
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;
|
return first_wv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Walk through thw 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
|
/* Recompute all the widgets of frame F, when the menu bar has been
|
||||||
changed. Value is non-zero if widgets were updated. */
|
changed. Value is non-zero if widgets were updated. */
|
||||||
|
@ -1930,7 +1963,6 @@ set_frame_menubar (f, first_time, deep_p)
|
||||||
FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
|
FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
|
||||||
|
|
||||||
items = FRAME_MENU_BAR_ITEMS (f);
|
items = FRAME_MENU_BAR_ITEMS (f);
|
||||||
inhibit_garbage_collection ();
|
|
||||||
|
|
||||||
/* Save the frame's previous menu bar contents data. */
|
/* Save the frame's previous menu bar contents data. */
|
||||||
if (previous_menu_items_used)
|
if (previous_menu_items_used)
|
||||||
|
@ -2023,9 +2055,10 @@ set_frame_menubar (f, first_time, deep_p)
|
||||||
Lisp_Object string;
|
Lisp_Object string;
|
||||||
string = XVECTOR (items)->contents[i + 1];
|
string = XVECTOR (items)->contents[i + 1];
|
||||||
if (NILP (string))
|
if (NILP (string))
|
||||||
break;
|
break;
|
||||||
wv->name = (char *) SDATA (string);
|
wv->name = (char *) SDATA (ENCODE_MENU_STRING (string));
|
||||||
wv = wv->next;
|
update_submenu_strings (wv->contents);
|
||||||
|
wv = wv->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->menu_bar_vector = menu_items;
|
f->menu_bar_vector = menu_items;
|
||||||
|
@ -2055,7 +2088,7 @@ set_frame_menubar (f, first_time, deep_p)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
wv = xmalloc_widget_value ();
|
wv = xmalloc_widget_value ();
|
||||||
wv->name = (char *) SDATA (string);
|
wv->name = (char *) SDATA (ENCODE_MENU_STRING (string));
|
||||||
wv->value = 0;
|
wv->value = 0;
|
||||||
wv->enabled = 1;
|
wv->enabled = 1;
|
||||||
wv->button_type = BUTTON_TYPE_NONE;
|
wv->button_type = BUTTON_TYPE_NONE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue