487 |
|
|
488 |
/* This is a subroutine of single_keymap_panes that handles one |
/* This is a subroutine of single_keymap_panes that handles one |
489 |
keymap entry. |
keymap entry. |
490 |
KEY is a key in a keymap and ITEM is its binding. |
KEY is a key in a keymap and ITEM is its binding. |
491 |
PENDING_MAPS_PTR points to a list of keymaps waiting to be made into |
PENDING_MAPS_PTR points to a list of keymaps waiting to be made into |
492 |
separate panes. |
separate panes. |
493 |
If NOTREAL is nonzero, only check for equivalent key bindings, don't |
If NOTREAL is nonzero, only check for equivalent key bindings, don't |
508 |
Lisp_Object map, item_string, enabled; |
Lisp_Object map, item_string, enabled; |
509 |
struct gcpro gcpro1, gcpro2; |
struct gcpro gcpro1, gcpro2; |
510 |
int res; |
int res; |
511 |
|
|
512 |
/* Parse the menu item and leave the result in item_properties. */ |
/* Parse the menu item and leave the result in item_properties. */ |
513 |
GCPRO2 (key, item); |
GCPRO2 (key, item); |
514 |
res = parse_menu_item (item, notreal, 0); |
res = parse_menu_item (item, notreal, 0); |
517 |
return; /* Not a menu item. */ |
return; /* Not a menu item. */ |
518 |
|
|
519 |
map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; |
map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; |
520 |
|
|
521 |
if (notreal) |
if (notreal) |
522 |
{ |
{ |
523 |
/* We don't want to make a menu, just traverse the keymaps to |
/* We don't want to make a menu, just traverse the keymaps to |
528 |
} |
} |
529 |
|
|
530 |
enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
531 |
item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; |
item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; |
532 |
|
|
533 |
if (!NILP (map) && SREF (item_string, 0) == '@') |
if (!NILP (map) && SREF (item_string, 0) == '@') |
534 |
{ |
{ |
601 |
item_string = concat2 (prefix, item_string); |
item_string = concat2 (prefix, item_string); |
602 |
} |
} |
603 |
#endif /* not HAVE_BOXES */ |
#endif /* not HAVE_BOXES */ |
604 |
|
|
605 |
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) |
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) |
606 |
if (!NILP(map)) |
if (!NILP(map)) |
607 |
/* Indicate visually that this is a submenu. */ |
/* Indicate visually that this is a submenu. */ |
696 |
int dummy; |
int dummy; |
697 |
|
|
698 |
BLOCK_INPUT; |
BLOCK_INPUT; |
699 |
|
|
700 |
XQueryPointer (FRAME_X_DISPLAY (f), |
XQueryPointer (FRAME_X_DISPLAY (f), |
701 |
DefaultRootWindow (FRAME_X_DISPLAY (f)), |
DefaultRootWindow (FRAME_X_DISPLAY (f)), |
702 |
|
|
835 |
x = make_number (cur_x); |
x = make_number (cur_x); |
836 |
y = make_number (cur_y); |
y = make_number (cur_y); |
837 |
} |
} |
838 |
|
|
839 |
#else /* not HAVE_X_WINDOWS */ |
#else /* not HAVE_X_WINDOWS */ |
840 |
Lisp_Object bar_window; |
Lisp_Object bar_window; |
841 |
enum scroll_bar_part part; |
enum scroll_bar_part part; |
957 |
|
|
958 |
keymaps = 0; |
keymaps = 0; |
959 |
} |
} |
960 |
|
|
961 |
unbind_to (specpdl_count, Qnil); |
unbind_to (specpdl_count, Qnil); |
962 |
|
|
963 |
if (NILP (position)) |
if (NILP (position)) |
1146 |
&& dpyinfo->display == event.xbutton.display) |
&& dpyinfo->display == event.xbutton.display) |
1147 |
{ |
{ |
1148 |
dpyinfo->grabbed &= ~(1 << event.xbutton.button); |
dpyinfo->grabbed &= ~(1 << event.xbutton.button); |
1149 |
#ifdef USE_MOTIF /* Pretending that the event came from a |
#ifdef USE_MOTIF /* Pretending that the event came from a |
1150 |
Btn1Down seems the only way to convince Motif to |
Btn1Down seems the only way to convince Motif to |
1151 |
activate its callbacks; setting the XmNmenuPost |
activate its callbacks; setting the XmNmenuPost |
1152 |
isn't working. --marcus@sysc.pdx.edu. */ |
isn't working. --marcus@sysc.pdx.edu. */ |
1167 |
if (!IsModifierKey (keysym)) |
if (!IsModifierKey (keysym)) |
1168 |
popup_activated_flag = 0; |
popup_activated_flag = 0; |
1169 |
} |
} |
1170 |
|
|
1171 |
x_dispatch_event (&event, event.xany.display); |
x_dispatch_event (&event, event.xany.display); |
1172 |
} |
} |
1173 |
} |
} |
1203 |
The reason for saving the button event until here, instead of |
The reason for saving the button event until here, instead of |
1204 |
passing it to the toolkit right away, is that we can safely |
passing it to the toolkit right away, is that we can safely |
1205 |
execute Lisp code. */ |
execute Lisp code. */ |
1206 |
|
|
1207 |
void |
void |
1208 |
x_activate_menubar (f) |
x_activate_menubar (f) |
1209 |
FRAME_PTR f; |
FRAME_PTR f; |
1211 |
if (!f->output_data.x->saved_menu_event->type) |
if (!f->output_data.x->saved_menu_event->type) |
1212 |
return; |
return; |
1213 |
|
|
1214 |
#ifdef USE_GTK |
#ifdef USE_GTK |
1215 |
if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window)) |
if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window)) |
1216 |
return; |
return; |
1217 |
#endif |
#endif |
1218 |
|
|
1219 |
set_frame_menubar (f, 0, 1); |
set_frame_menubar (f, 0, 1); |
1220 |
BLOCK_INPUT; |
BLOCK_INPUT; |
1221 |
#ifdef USE_GTK |
#ifdef USE_GTK |
1230 |
if (f->output_data.x->saved_menu_event->type == ButtonRelease) |
if (f->output_data.x->saved_menu_event->type == ButtonRelease) |
1231 |
pending_menu_activation = 1; |
pending_menu_activation = 1; |
1232 |
#endif |
#endif |
1233 |
|
|
1234 |
/* Ignore this if we get it a second time. */ |
/* Ignore this if we get it a second time. */ |
1235 |
f->output_data.x->saved_menu_event->type = 0; |
f->output_data.x->saved_menu_event->type = 0; |
1236 |
} |
} |
1298 |
} |
} |
1299 |
else |
else |
1300 |
{ |
{ |
1301 |
/* WIDGET is the popup menu. It's parent is the frame's |
/* WIDGET is the popup menu. It's parent is the frame's |
1302 |
widget. See which frame that is. */ |
widget. See which frame that is. */ |
1303 |
xt_or_gtk_widget frame_widget = XtParent (widget); |
xt_or_gtk_widget frame_widget = XtParent (widget); |
1304 |
Lisp_Object tail; |
Lisp_Object tail; |
1330 |
{ |
{ |
1331 |
xg_menu_item_cb_data *cb_data; |
xg_menu_item_cb_data *cb_data; |
1332 |
Lisp_Object help; |
Lisp_Object help; |
1333 |
|
|
1334 |
cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget), |
cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget), |
1335 |
XG_ITEM_DATA); |
XG_ITEM_DATA); |
1336 |
if (! cb_data) return; |
if (! cb_data) return; |
1356 |
widget_value *wv = (widget_value *) call_data; |
widget_value *wv = (widget_value *) call_data; |
1357 |
|
|
1358 |
help = wv ? wv->help : Qnil; |
help = wv ? wv->help : Qnil; |
1359 |
|
|
1360 |
/* Determine the frame for the help event. */ |
/* Determine the frame for the help event. */ |
1361 |
f = menubar_id_to_frame (id); |
f = menubar_id_to_frame (id); |
1362 |
|
|
1620 |
first_wv = wv; |
first_wv = wv; |
1621 |
save_wv = 0; |
save_wv = 0; |
1622 |
prev_wv = 0; |
prev_wv = 0; |
1623 |
|
|
1624 |
/* Loop over all panes and items made by the preceding call |
/* Loop over all panes and items made by the preceding call |
1625 |
to parse_single_submenu and construct a tree of widget_value objects. |
to parse_single_submenu and construct a tree of widget_value objects. |
1626 |
Ignore the panes and items used by previous calls to |
Ignore the panes and items used by previous calls to |
1653 |
/* Create a new pane. */ |
/* Create a new pane. */ |
1654 |
Lisp_Object pane_name, prefix; |
Lisp_Object pane_name, prefix; |
1655 |
char *pane_string; |
char *pane_string; |
1656 |
|
|
1657 |
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
1658 |
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
1659 |
|
|
1660 |
#ifndef HAVE_MULTILINGUAL_MENU |
#ifndef HAVE_MULTILINGUAL_MENU |
1661 |
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
1662 |
{ |
{ |
1700 |
/* Create a new item within current pane. */ |
/* Create a new item within current pane. */ |
1701 |
Lisp_Object item_name, enable, descrip, def, type, selected; |
Lisp_Object item_name, enable, descrip, def, type, selected; |
1702 |
Lisp_Object help; |
Lisp_Object help; |
1703 |
|
|
1704 |
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
1705 |
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
1706 |
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
1715 |
item_name = ENCODE_SYSTEM (item_name); |
item_name = ENCODE_SYSTEM (item_name); |
1716 |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
1717 |
} |
} |
1718 |
|
|
1719 |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
1720 |
{ |
{ |
1721 |
descrip = ENCODE_SYSTEM (descrip); |
descrip = ENCODE_SYSTEM (descrip); |
1724 |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
1725 |
|
|
1726 |
wv = xmalloc_widget_value (); |
wv = xmalloc_widget_value (); |
1727 |
if (prev_wv) |
if (prev_wv) |
1728 |
prev_wv->next = wv; |
prev_wv->next = wv; |
1729 |
else |
else |
1730 |
save_wv->contents = wv; |
save_wv->contents = wv; |
1737 |
as long as pointers have enough bits to hold small integers. */ |
as long as pointers have enough bits to hold small integers. */ |
1738 |
wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); |
wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); |
1739 |
wv->enabled = !NILP (enable); |
wv->enabled = !NILP (enable); |
1740 |
|
|
1741 |
if (NILP (type)) |
if (NILP (type)) |
1742 |
wv->button_type = BUTTON_TYPE_NONE; |
wv->button_type = BUTTON_TYPE_NONE; |
1743 |
else if (EQ (type, QCradio)) |
else if (EQ (type, QCradio)) |
1783 |
#else |
#else |
1784 |
struct x_output *x = f->output_data.x; |
struct x_output *x = f->output_data.x; |
1785 |
int columns, rows; |
int columns, rows; |
1786 |
|
|
1787 |
if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) |
if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) |
1788 |
return 0; |
return 0; |
1789 |
|
|
1847 |
f->output_data.x->id = next_menubar_widget_id++; |
f->output_data.x->id = next_menubar_widget_id++; |
1848 |
id = f->output_data.x->id; |
id = f->output_data.x->id; |
1849 |
#endif |
#endif |
1850 |
|
|
1851 |
if (! menubar_widget) |
if (! menubar_widget) |
1852 |
deep_p = 1; |
deep_p = 1; |
1853 |
else if (pending_menu_activation && !deep_p) |
else if (pending_menu_activation && !deep_p) |
1895 |
|
|
1896 |
/* Run the Lucid hook. */ |
/* Run the Lucid hook. */ |
1897 |
safe_run_hooks (Qactivate_menubar_hook); |
safe_run_hooks (Qactivate_menubar_hook); |
1898 |
|
|
1899 |
/* If it has changed current-menubar from previous value, |
/* If it has changed current-menubar from previous value, |
1900 |
really recompute the menubar from the value. */ |
really recompute the menubar from the value. */ |
1901 |
if (! NILP (Vlucid_menu_bar_dirty_flag)) |
if (! NILP (Vlucid_menu_bar_dirty_flag)) |
1960 |
menu_items_n_panes = submenu_n_panes[i]; |
menu_items_n_panes = submenu_n_panes[i]; |
1961 |
wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
1962 |
submenu_top_level_items[i]); |
submenu_top_level_items[i]); |
1963 |
if (prev_wv) |
if (prev_wv) |
1964 |
prev_wv->next = wv; |
prev_wv->next = wv; |
1965 |
else |
else |
1966 |
first_wv->contents = wv; |
first_wv->contents = wv; |
2039 |
This value just has to be different from small integers. */ |
This value just has to be different from small integers. */ |
2040 |
wv->call_data = (void *) (EMACS_INT) (-1); |
wv->call_data = (void *) (EMACS_INT) (-1); |
2041 |
|
|
2042 |
if (prev_wv) |
if (prev_wv) |
2043 |
prev_wv->next = wv; |
prev_wv->next = wv; |
2044 |
else |
else |
2045 |
first_wv->contents = wv; |
first_wv->contents = wv; |
2073 |
else |
else |
2074 |
{ |
{ |
2075 |
GtkWidget *wvbox = f->output_data.x->vbox_widget; |
GtkWidget *wvbox = f->output_data.x->vbox_widget; |
2076 |
|
|
2077 |
menubar_widget |
menubar_widget |
2078 |
= xg_create_widget ("menubar", "menubar", f, first_wv, |
= xg_create_widget ("menubar", "menubar", f, first_wv, |
2079 |
G_CALLBACK (menubar_selection_callback), |
G_CALLBACK (menubar_selection_callback), |
2080 |
G_CALLBACK (popup_deactivate_callback), |
G_CALLBACK (popup_deactivate_callback), |
2081 |
G_CALLBACK (menu_highlight_callback)); |
G_CALLBACK (menu_highlight_callback)); |
2083 |
f->output_data.x->menubar_widget = menubar_widget; |
f->output_data.x->menubar_widget = menubar_widget; |
2084 |
} |
} |
2085 |
|
|
2086 |
|
|
2087 |
#else /* not USE_GTK */ |
#else /* not USE_GTK */ |
2088 |
if (menubar_widget) |
if (menubar_widget) |
2089 |
{ |
{ |
2099 |
} |
} |
2100 |
else |
else |
2101 |
{ |
{ |
2102 |
menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, |
menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, |
2103 |
f->output_data.x->column_widget, |
f->output_data.x->column_widget, |
2104 |
0, |
0, |
2105 |
popup_activate_callback, |
popup_activate_callback, |
2110 |
} |
} |
2111 |
|
|
2112 |
{ |
{ |
2113 |
int menubar_size |
int menubar_size |
2114 |
= (f->output_data.x->menubar_widget |
= (f->output_data.x->menubar_widget |
2115 |
? (f->output_data.x->menubar_widget->core.height |
? (f->output_data.x->menubar_widget->core.height |
2116 |
+ f->output_data.x->menubar_widget->core.border_width) |
+ f->output_data.x->menubar_widget->core.border_width) |
2132 |
f->output_data.x->menubar_height = menubar_size; |
f->output_data.x->menubar_height = menubar_size; |
2133 |
} |
} |
2134 |
#endif /* not USE_GTK */ |
#endif /* not USE_GTK */ |
2135 |
|
|
2136 |
free_menubar_widget_value_tree (first_wv); |
free_menubar_widget_value_tree (first_wv); |
2137 |
update_frame_menubar (f); |
update_frame_menubar (f); |
2138 |
|
|
2173 |
menubar_widget = f->output_data.x->menubar_widget; |
menubar_widget = f->output_data.x->menubar_widget; |
2174 |
|
|
2175 |
f->output_data.x->menubar_height = 0; |
f->output_data.x->menubar_height = 0; |
2176 |
|
|
2177 |
if (menubar_widget) |
if (menubar_widget) |
2178 |
{ |
{ |
2179 |
#ifdef USE_MOTIF |
#ifdef USE_MOTIF |
2187 |
is switched off, which fixes the shell position. */ |
is switched off, which fixes the shell position. */ |
2188 |
Position x0, y0, x1, y1; |
Position x0, y0, x1, y1; |
2189 |
#endif |
#endif |
2190 |
|
|
2191 |
BLOCK_INPUT; |
BLOCK_INPUT; |
2192 |
|
|
2193 |
#ifdef USE_MOTIF |
#ifdef USE_MOTIF |
2194 |
if (f->output_data.x->widget) |
if (f->output_data.x->widget) |
2195 |
XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL); |
XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL); |
2196 |
#endif |
#endif |
2197 |
|
|
2198 |
lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id); |
lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id); |
2199 |
f->output_data.x->menubar_widget = NULL; |
f->output_data.x->menubar_widget = NULL; |
2200 |
|
|
2206 |
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); |
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); |
2207 |
} |
} |
2208 |
#endif |
#endif |
2209 |
|
|
2210 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
2211 |
} |
} |
2212 |
} |
} |
2300 |
G_CALLBACK (popup_deactivate_callback), |
G_CALLBACK (popup_deactivate_callback), |
2301 |
G_CALLBACK (menu_highlight_callback)); |
G_CALLBACK (menu_highlight_callback)); |
2302 |
xg_crazy_callback_abort = 0; |
xg_crazy_callback_abort = 0; |
2303 |
|
|
2304 |
for (i = 0; i < 5; i++) |
for (i = 0; i < 5; i++) |
2305 |
if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) |
if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) |
2306 |
break; |
break; |
2321 |
/* Display the menu. */ |
/* Display the menu. */ |
2322 |
gtk_widget_show_all (menu); |
gtk_widget_show_all (menu); |
2323 |
gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); |
gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); |
2324 |
|
|
2325 |
xg_did_tearoff = 0; |
xg_did_tearoff = 0; |
2326 |
/* Set this to one. popup_widget_loop increases it by one, so it becomes |
/* Set this to one. popup_widget_loop increases it by one, so it becomes |
2327 |
two. show_help_echo uses this to detect popup menus. */ |
two. show_help_echo uses this to detect popup menus. */ |
2333 |
xg_keep_popup (menu, xg_did_tearoff); |
xg_keep_popup (menu, xg_did_tearoff); |
2334 |
else |
else |
2335 |
gtk_widget_destroy (menu); |
gtk_widget_destroy (menu); |
2336 |
|
|
2337 |
/* Must reset this manually because the button release event is not passed |
/* Must reset this manually because the button release event is not passed |
2338 |
to Emacs event loop. */ |
to Emacs event loop. */ |
2339 |
FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
2425 |
that it is unnecessary--that the menu has already disappeared. |
that it is unnecessary--that the menu has already disappeared. |
2426 |
Nowadays the menu disappears ok, all right, but |
Nowadays the menu disappears ok, all right, but |
2427 |
we need to delete the widgets or multiple ones will pile up. */ |
we need to delete the widgets or multiple ones will pile up. */ |
2428 |
lw_destroy_all_widgets (menu_id); |
lw_destroy_all_widgets (menu_id); |
2429 |
} |
} |
2430 |
|
|
2431 |
#endif /* not USE_GTK */ |
#endif /* not USE_GTK */ |
2468 |
wv->help =Qnil; |
wv->help =Qnil; |
2469 |
first_wv = wv; |
first_wv = wv; |
2470 |
first_pane = 1; |
first_pane = 1; |
2471 |
|
|
2472 |
/* Loop over all panes and items, filling in the tree. */ |
/* Loop over all panes and items, filling in the tree. */ |
2473 |
i = 0; |
i = 0; |
2474 |
while (i < menu_items_used) |
while (i < menu_items_used) |
2500 |
/* Create a new pane. */ |
/* Create a new pane. */ |
2501 |
Lisp_Object pane_name, prefix; |
Lisp_Object pane_name, prefix; |
2502 |
char *pane_string; |
char *pane_string; |
2503 |
|
|
2504 |
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
2505 |
prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
2506 |
|
|
2507 |
#ifndef HAVE_MULTILINGUAL_MENU |
#ifndef HAVE_MULTILINGUAL_MENU |
2508 |
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
2509 |
{ |
{ |
2564 |
item_name = ENCODE_SYSTEM (item_name); |
item_name = ENCODE_SYSTEM (item_name); |
2565 |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
2566 |
} |
} |
2567 |
|
|
2568 |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
2569 |
{ |
{ |
2570 |
descrip = ENCODE_SYSTEM (descrip); |
descrip = ENCODE_SYSTEM (descrip); |
2571 |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
2572 |
} |
} |
2573 |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
2574 |
|
|
2575 |
wv = xmalloc_widget_value (); |
wv = xmalloc_widget_value (); |
2576 |
if (prev_wv) |
if (prev_wv) |
2577 |
prev_wv->next = wv; |
prev_wv->next = wv; |
2578 |
else |
else |
2579 |
save_wv->contents = wv; |
save_wv->contents = wv; |
2580 |
wv->name = (char *) SDATA (item_name); |
wv->name = (char *) SDATA (item_name); |
2581 |
if (!NILP (descrip)) |
if (!NILP (descrip)) |
2629 |
if (STRING_MULTIBYTE (title)) |
if (STRING_MULTIBYTE (title)) |
2630 |
title = ENCODE_SYSTEM (title); |
title = ENCODE_SYSTEM (title); |
2631 |
#endif |
#endif |
2632 |
|
|
2633 |
wv_title->name = (char *) SDATA (title); |
wv_title->name = (char *) SDATA (title); |
2634 |
wv_title->enabled = TRUE; |
wv_title->enabled = TRUE; |
2635 |
wv_title->button_type = BUTTON_TYPE_NONE; |
wv_title->button_type = BUTTON_TYPE_NONE; |
2741 |
|
|
2742 |
/* Process events that apply to the menu. */ |
/* Process events that apply to the menu. */ |
2743 |
popup_widget_loop (); |
popup_widget_loop (); |
2744 |
|
|
2745 |
gtk_widget_destroy (menu); |
gtk_widget_destroy (menu); |
2746 |
} |
} |
2747 |
} |
} |
2807 |
{ |
{ |
2808 |
int count = SPECPDL_INDEX (); |
int count = SPECPDL_INDEX (); |
2809 |
int fact = 4 * sizeof (LWLIB_ID); |
int fact = 4 * sizeof (LWLIB_ID); |
2810 |
|
|
2811 |
/* xdialog_show_unwind is responsible for popping the dialog box down. */ |
/* xdialog_show_unwind is responsible for popping the dialog box down. */ |
2812 |
record_unwind_protect (xdialog_show_unwind, |
record_unwind_protect (xdialog_show_unwind, |
2813 |
Fcons (make_number (dialog_id >> (fact)), |
Fcons (make_number (dialog_id >> (fact)), |
2858 |
pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
2859 |
prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
2860 |
pane_string = (NILP (pane_name) |
pane_string = (NILP (pane_name) |
2861 |
? "" : (char *) SDATA (pane_name)); |
? "" : (char *) SDATA (pane_name)); |
2862 |
prev_wv = xmalloc_widget_value (); |
prev_wv = xmalloc_widget_value (); |
2863 |
prev_wv->value = pane_string; |
prev_wv->value = pane_string; |
2864 |
if (keymaps && !NILP (prefix)) |
if (keymaps && !NILP (prefix)) |
2867 |
prev_wv->name = "message"; |
prev_wv->name = "message"; |
2868 |
prev_wv->help = Qnil; |
prev_wv->help = Qnil; |
2869 |
first_wv = prev_wv; |
first_wv = prev_wv; |
2870 |
|
|
2871 |
/* Loop over all panes and items, filling in the tree. */ |
/* Loop over all panes and items, filling in the tree. */ |
2872 |
i = MENU_ITEMS_PANE_LENGTH; |
i = MENU_ITEMS_PANE_LENGTH; |
2873 |
while (i < menu_items_used) |
while (i < menu_items_used) |
2874 |
{ |
{ |
2875 |
|
|
2876 |
/* Create a new item within current pane. */ |
/* Create a new item within current pane. */ |
2877 |
Lisp_Object item_name, enable, descrip; |
Lisp_Object item_name, enable, descrip; |
2878 |
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; |
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; |
2879 |
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; |
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; |
2880 |
descrip |
descrip |
2881 |
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
2882 |
|
|
2883 |
if (NILP (item_name)) |
if (NILP (item_name)) |
2884 |
{ |
{ |
2885 |
free_menubar_widget_value_tree (first_wv); |
free_menubar_widget_value_tree (first_wv); |
2950 |
|
|
2951 |
/* Free the widget_value objects we used to specify the contents. */ |
/* Free the widget_value objects we used to specify the contents. */ |
2952 |
free_menubar_widget_value_tree (first_wv); |
free_menubar_widget_value_tree (first_wv); |
2953 |
|
|
2954 |
/* Find the selected item, and its pane, to return |
/* Find the selected item, and its pane, to return |
2955 |
the proper value. */ |
the proper value. */ |
2956 |
if (menu_item_selection != 0) |
if (menu_item_selection != 0) |
3009 |
|
|
3010 |
PANE is the pane number, and ITEM is the menu item number in |
PANE is the pane number, and ITEM is the menu item number in |
3011 |
the menu (currently not used). |
the menu (currently not used). |
3012 |
|
|
3013 |
This cannot be done with generating a HELP_EVENT because |
This cannot be done with generating a HELP_EVENT because |
3014 |
XMenuActivate contains a loop that doesn't let Emacs process |
XMenuActivate contains a loop that doesn't let Emacs process |
3015 |
keyboard events. */ |
keyboard events. */ |
3023 |
Lisp_Object *first_item; |
Lisp_Object *first_item; |
3024 |
Lisp_Object pane_name; |
Lisp_Object pane_name; |
3025 |
Lisp_Object menu_object; |
Lisp_Object menu_object; |
3026 |
|
|
3027 |
first_item = XVECTOR (menu_items)->contents; |
first_item = XVECTOR (menu_items)->contents; |
3028 |
if (EQ (first_item[0], Qt)) |
if (EQ (first_item[0], Qt)) |
3029 |
pane_name = first_item[MENU_ITEMS_PANE_NAME]; |
pane_name = first_item[MENU_ITEMS_PANE_NAME]; |
3032 |
pane_name = empty_string; |
pane_name = empty_string; |
3033 |
else |
else |
3034 |
pane_name = first_item[MENU_ITEMS_ITEM_NAME]; |
pane_name = first_item[MENU_ITEMS_ITEM_NAME]; |
3035 |
|
|
3036 |
/* (menu-item MENU-NAME PANE-NUMBER) */ |
/* (menu-item MENU-NAME PANE-NUMBER) */ |
3037 |
menu_object = Fcons (Qmenu_item, |
menu_object = Fcons (Qmenu_item, |
3038 |
Fcons (pane_name, |
Fcons (pane_name, |
3040 |
show_help_echo (help_string ? build_string (help_string) : Qnil, |
show_help_echo (help_string ? build_string (help_string) : Qnil, |
3041 |
Qnil, menu_object, make_number (item), 1); |
Qnil, menu_object, make_number (item), 1); |
3042 |
} |
} |
3043 |
|
|
3044 |
|
|
3045 |
static Lisp_Object |
static Lisp_Object |
3046 |
xmenu_show (f, x, y, for_click, keymaps, title, error) |
xmenu_show (f, x, y, for_click, keymaps, title, error) |
3051 |
Lisp_Object title; |
Lisp_Object title; |
3052 |
char **error; |
char **error; |
3053 |
{ |
{ |
3054 |
Window root; |
Window root; |
3055 |
XMenu *menu; |
XMenu *menu; |
3056 |
int pane, selidx, lpane, status; |
int pane, selidx, lpane, status; |
3057 |
Lisp_Object entry, pane_prefix; |
Lisp_Object entry, pane_prefix; |
3118 |
/* Adjust coordinates to be root-window-relative. */ |
/* Adjust coordinates to be root-window-relative. */ |
3119 |
x += f->output_data.x->left_pos; |
x += f->output_data.x->left_pos; |
3120 |
y += f->output_data.x->top_pos; |
y += f->output_data.x->top_pos; |
3121 |
|
|
3122 |
/* Create all the necessary panes and their items. */ |
/* Create all the necessary panes and their items. */ |
3123 |
i = 0; |
i = 0; |
3124 |
while (i < menu_items_used) |
while (i < menu_items_used) |
3183 |
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
3184 |
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; |
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; |
3185 |
help_string = STRINGP (help) ? SDATA (help) : NULL; |
help_string = STRINGP (help) ? SDATA (help) : NULL; |
3186 |
|
|
3187 |
if (!NILP (descrip)) |
if (!NILP (descrip)) |
3188 |
{ |
{ |
3189 |
int gap = maxwidth - SBYTES (item_name); |
int gap = maxwidth - SBYTES (item_name); |
3347 |
Vmenu_updating_frame = Qnil; |
Vmenu_updating_frame = Qnil; |
3348 |
|
|
3349 |
#ifdef USE_X_TOOLKIT |
#ifdef USE_X_TOOLKIT |
3350 |
widget_id_tick = (1<<16); |
widget_id_tick = (1<<16); |
3351 |
next_menubar_widget_id = 1; |
next_menubar_widget_id = 1; |
3352 |
#endif |
#endif |
3353 |
|
|