comparison src/xmenu.c @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents 2cbb0b823e83
children 05ebf4266798
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
485 } 485 }
486 } 486 }
487 487
488 /* This is a subroutine of single_keymap_panes that handles one 488 /* This is a subroutine of single_keymap_panes that handles one
489 keymap entry. 489 keymap entry.
490 KEY is a key in a keymap and ITEM is its binding. 490 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 491 PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
492 separate panes. 492 separate panes.
493 If NOTREAL is nonzero, only check for equivalent key bindings, don't 493 If NOTREAL is nonzero, only check for equivalent key bindings, don't
494 evaluate expressions in menu items and don't make any menu. 494 evaluate expressions in menu items and don't make any menu.
495 If we encounter submenus deeper than MAXDEPTH levels, ignore them. 495 If we encounter submenus deeper than MAXDEPTH levels, ignore them.
506 int *notbuttons_ptr; 506 int *notbuttons_ptr;
507 { 507 {
508 Lisp_Object map, item_string, enabled; 508 Lisp_Object map, item_string, enabled;
509 struct gcpro gcpro1, gcpro2; 509 struct gcpro gcpro1, gcpro2;
510 int res; 510 int res;
511 511
512 /* Parse the menu item and leave the result in item_properties. */ 512 /* Parse the menu item and leave the result in item_properties. */
513 GCPRO2 (key, item); 513 GCPRO2 (key, item);
514 res = parse_menu_item (item, notreal, 0); 514 res = parse_menu_item (item, notreal, 0);
515 UNGCPRO; 515 UNGCPRO;
516 if (!res) 516 if (!res)
517 return; /* Not a menu item. */ 517 return; /* Not a menu item. */
518 518
519 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; 519 map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
520 520
521 if (notreal) 521 if (notreal)
522 { 522 {
523 /* We don't want to make a menu, just traverse the keymaps to 523 /* We don't want to make a menu, just traverse the keymaps to
524 precompute equivalent key bindings. */ 524 precompute equivalent key bindings. */
525 if (!NILP (map)) 525 if (!NILP (map))
526 single_keymap_panes (map, Qnil, key, 1, maxdepth - 1); 526 single_keymap_panes (map, Qnil, key, 1, maxdepth - 1);
527 return; 527 return;
528 } 528 }
529 529
530 enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; 530 enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
531 item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; 531 item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
532 532
533 if (!NILP (map) && SREF (item_string, 0) == '@') 533 if (!NILP (map) && SREF (item_string, 0) == '@')
534 { 534 {
535 if (!NILP (enabled)) 535 if (!NILP (enabled))
536 /* An enabled separate pane. Remember this to handle it later. */ 536 /* An enabled separate pane. Remember this to handle it later. */
599 599
600 if (!NILP (prefix)) 600 if (!NILP (prefix))
601 item_string = concat2 (prefix, item_string); 601 item_string = concat2 (prefix, item_string);
602 } 602 }
603 #endif /* not HAVE_BOXES */ 603 #endif /* not HAVE_BOXES */
604 604
605 #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) 605 #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
606 if (!NILP(map)) 606 if (!NILP(map))
607 /* Indicate visually that this is a submenu. */ 607 /* Indicate visually that this is a submenu. */
608 item_string = concat2 (item_string, build_string (" >")); 608 item_string = concat2 (item_string, build_string (" >"));
609 #endif 609 #endif
694 { 694 {
695 Window root, dummy_window; 695 Window root, dummy_window;
696 int dummy; 696 int dummy;
697 697
698 BLOCK_INPUT; 698 BLOCK_INPUT;
699 699
700 XQueryPointer (FRAME_X_DISPLAY (f), 700 XQueryPointer (FRAME_X_DISPLAY (f),
701 DefaultRootWindow (FRAME_X_DISPLAY (f)), 701 DefaultRootWindow (FRAME_X_DISPLAY (f)),
702 702
703 /* The root window which contains the pointer. */ 703 /* The root window which contains the pointer. */
704 &root, 704 &root,
833 mouse_position_for_popup (new_f, &cur_x, &cur_y); 833 mouse_position_for_popup (new_f, &cur_x, &cur_y);
834 /* cur_x/y may be negative, so use make_number. */ 834 /* cur_x/y may be negative, so use make_number. */
835 x = make_number (cur_x); 835 x = make_number (cur_x);
836 y = make_number (cur_y); 836 y = make_number (cur_y);
837 } 837 }
838 838
839 #else /* not HAVE_X_WINDOWS */ 839 #else /* not HAVE_X_WINDOWS */
840 Lisp_Object bar_window; 840 Lisp_Object bar_window;
841 enum scroll_bar_part part; 841 enum scroll_bar_part part;
842 unsigned long time; 842 unsigned long time;
843 843
955 955
956 list_of_panes (Fcdr (menu)); 956 list_of_panes (Fcdr (menu));
957 957
958 keymaps = 0; 958 keymaps = 0;
959 } 959 }
960 960
961 unbind_to (specpdl_count, Qnil); 961 unbind_to (specpdl_count, Qnil);
962 962
963 if (NILP (position)) 963 if (NILP (position))
964 { 964 {
965 discard_menu_items (); 965 discard_menu_items ();
1144 even if XtDispatchEvent doesn't do that. */ 1144 even if XtDispatchEvent doesn't do that. */
1145 if (event.type == ButtonRelease 1145 if (event.type == ButtonRelease
1146 && dpyinfo->display == event.xbutton.display) 1146 && dpyinfo->display == event.xbutton.display)
1147 { 1147 {
1148 dpyinfo->grabbed &= ~(1 << event.xbutton.button); 1148 dpyinfo->grabbed &= ~(1 << event.xbutton.button);
1149 #ifdef USE_MOTIF /* Pretending that the event came from a 1149 #ifdef USE_MOTIF /* Pretending that the event came from a
1150 Btn1Down seems the only way to convince Motif to 1150 Btn1Down seems the only way to convince Motif to
1151 activate its callbacks; setting the XmNmenuPost 1151 activate its callbacks; setting the XmNmenuPost
1152 isn't working. --marcus@sysc.pdx.edu. */ 1152 isn't working. --marcus@sysc.pdx.edu. */
1153 event.xbutton.button = 1; 1153 event.xbutton.button = 1;
1154 /* Motif only pops down menus when no Ctrl, Alt or Mod 1154 /* Motif only pops down menus when no Ctrl, Alt or Mod
1165 { 1165 {
1166 KeySym keysym = XLookupKeysym (&event.xkey, 0); 1166 KeySym keysym = XLookupKeysym (&event.xkey, 0);
1167 if (!IsModifierKey (keysym)) 1167 if (!IsModifierKey (keysym))
1168 popup_activated_flag = 0; 1168 popup_activated_flag = 0;
1169 } 1169 }
1170 1170
1171 x_dispatch_event (&event, event.xany.display); 1171 x_dispatch_event (&event, event.xany.display);
1172 } 1172 }
1173 } 1173 }
1174 1174
1175 #endif /* USE_X_TOOLKIT */ 1175 #endif /* USE_X_TOOLKIT */
1201 But first we recompute the menu bar contents (the whole tree). 1201 But first we recompute the menu bar contents (the whole tree).
1202 1202
1203 The reason for saving the button event until here, instead of 1203 The reason for saving the button event until here, instead of
1204 passing it to the toolkit right away, is that we can safely 1204 passing it to the toolkit right away, is that we can safely
1205 execute Lisp code. */ 1205 execute Lisp code. */
1206 1206
1207 void 1207 void
1208 x_activate_menubar (f) 1208 x_activate_menubar (f)
1209 FRAME_PTR f; 1209 FRAME_PTR f;
1210 { 1210 {
1211 if (!f->output_data.x->saved_menu_event->type) 1211 if (!f->output_data.x->saved_menu_event->type)
1212 return; 1212 return;
1213 1213
1214 #ifdef USE_GTK 1214 #ifdef USE_GTK
1215 if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window)) 1215 if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window))
1216 return; 1216 return;
1217 #endif 1217 #endif
1218 1218
1219 set_frame_menubar (f, 0, 1); 1219 set_frame_menubar (f, 0, 1);
1220 BLOCK_INPUT; 1220 BLOCK_INPUT;
1221 #ifdef USE_GTK 1221 #ifdef USE_GTK
1222 XPutBackEvent (f->output_data.x->display_info->display, 1222 XPutBackEvent (f->output_data.x->display_info->display,
1223 f->output_data.x->saved_menu_event); 1223 f->output_data.x->saved_menu_event);
1228 UNBLOCK_INPUT; 1228 UNBLOCK_INPUT;
1229 #ifdef USE_MOTIF 1229 #ifdef USE_MOTIF
1230 if (f->output_data.x->saved_menu_event->type == ButtonRelease) 1230 if (f->output_data.x->saved_menu_event->type == ButtonRelease)
1231 pending_menu_activation = 1; 1231 pending_menu_activation = 1;
1232 #endif 1232 #endif
1233 1233
1234 /* Ignore this if we get it a second time. */ 1234 /* Ignore this if we get it a second time. */
1235 f->output_data.x->saved_menu_event->type = 0; 1235 f->output_data.x->saved_menu_event->type = 0;
1236 } 1236 }
1237 1237
1238 /* Detect if a dialog or menu has been posted. */ 1238 /* Detect if a dialog or menu has been posted. */
1296 XSETFRAME (frame, f); 1296 XSETFRAME (frame, f);
1297 kbd_buffer_store_help_event (frame, help); 1297 kbd_buffer_store_help_event (frame, help);
1298 } 1298 }
1299 else 1299 else
1300 { 1300 {
1301 /* WIDGET is the popup menu. It's parent is the frame's 1301 /* WIDGET is the popup menu. It's parent is the frame's
1302 widget. See which frame that is. */ 1302 widget. See which frame that is. */
1303 xt_or_gtk_widget frame_widget = XtParent (widget); 1303 xt_or_gtk_widget frame_widget = XtParent (widget);
1304 Lisp_Object tail; 1304 Lisp_Object tail;
1305 1305
1306 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) 1306 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
1328 GtkWidget *widget; 1328 GtkWidget *widget;
1329 gpointer call_data; 1329 gpointer call_data;
1330 { 1330 {
1331 xg_menu_item_cb_data *cb_data; 1331 xg_menu_item_cb_data *cb_data;
1332 Lisp_Object help; 1332 Lisp_Object help;
1333 1333
1334 cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget), 1334 cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget),
1335 XG_ITEM_DATA); 1335 XG_ITEM_DATA);
1336 if (! cb_data) return; 1336 if (! cb_data) return;
1337 1337
1338 help = call_data ? cb_data->help : Qnil; 1338 help = call_data ? cb_data->help : Qnil;
1354 Lisp_Object help; 1354 Lisp_Object help;
1355 1355
1356 widget_value *wv = (widget_value *) call_data; 1356 widget_value *wv = (widget_value *) call_data;
1357 1357
1358 help = wv ? wv->help : Qnil; 1358 help = wv ? wv->help : Qnil;
1359 1359
1360 /* Determine the frame for the help event. */ 1360 /* Determine the frame for the help event. */
1361 f = menubar_id_to_frame (id); 1361 f = menubar_id_to_frame (id);
1362 1362
1363 show_help_event (f, widget, help); 1363 show_help_event (f, widget, help);
1364 } 1364 }
1618 wv->button_type = BUTTON_TYPE_NONE; 1618 wv->button_type = BUTTON_TYPE_NONE;
1619 wv->help = Qnil; 1619 wv->help = Qnil;
1620 first_wv = wv; 1620 first_wv = wv;
1621 save_wv = 0; 1621 save_wv = 0;
1622 prev_wv = 0; 1622 prev_wv = 0;
1623 1623
1624 /* Loop over all panes and items made by the preceding call 1624 /* Loop over all panes and items made by the preceding call
1625 to parse_single_submenu and construct a tree of widget_value objects. 1625 to parse_single_submenu and construct a tree of widget_value objects.
1626 Ignore the panes and items used by previous calls to 1626 Ignore the panes and items used by previous calls to
1627 digest_single_submenu, even though those are also in menu_items. */ 1627 digest_single_submenu, even though those are also in menu_items. */
1628 i = start; 1628 i = start;
1651 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) 1651 else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
1652 { 1652 {
1653 /* Create a new pane. */ 1653 /* Create a new pane. */
1654 Lisp_Object pane_name, prefix; 1654 Lisp_Object pane_name, prefix;
1655 char *pane_string; 1655 char *pane_string;
1656 1656
1657 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; 1657 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
1658 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; 1658 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
1659 1659
1660 #ifndef HAVE_MULTILINGUAL_MENU 1660 #ifndef HAVE_MULTILINGUAL_MENU
1661 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) 1661 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
1662 { 1662 {
1663 pane_name = ENCODE_SYSTEM (pane_name); 1663 pane_name = ENCODE_SYSTEM (pane_name);
1664 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; 1664 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
1698 else 1698 else
1699 { 1699 {
1700 /* Create a new item within current pane. */ 1700 /* Create a new item within current pane. */
1701 Lisp_Object item_name, enable, descrip, def, type, selected; 1701 Lisp_Object item_name, enable, descrip, def, type, selected;
1702 Lisp_Object help; 1702 Lisp_Object help;
1703 1703
1704 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); 1704 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
1705 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); 1705 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
1706 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); 1706 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
1707 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION); 1707 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
1708 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE); 1708 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
1713 if (STRING_MULTIBYTE (item_name)) 1713 if (STRING_MULTIBYTE (item_name))
1714 { 1714 {
1715 item_name = ENCODE_SYSTEM (item_name); 1715 item_name = ENCODE_SYSTEM (item_name);
1716 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; 1716 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
1717 } 1717 }
1718 1718
1719 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) 1719 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
1720 { 1720 {
1721 descrip = ENCODE_SYSTEM (descrip); 1721 descrip = ENCODE_SYSTEM (descrip);
1722 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; 1722 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
1723 } 1723 }
1724 #endif /* not HAVE_MULTILINGUAL_MENU */ 1724 #endif /* not HAVE_MULTILINGUAL_MENU */
1725 1725
1726 wv = xmalloc_widget_value (); 1726 wv = xmalloc_widget_value ();
1727 if (prev_wv) 1727 if (prev_wv)
1728 prev_wv->next = wv; 1728 prev_wv->next = wv;
1729 else 1729 else
1730 save_wv->contents = wv; 1730 save_wv->contents = wv;
1731 1731
1732 wv->name = (char *) SDATA (item_name); 1732 wv->name = (char *) SDATA (item_name);
1735 wv->value = 0; 1735 wv->value = 0;
1736 /* The EMACS_INT cast avoids a warning. There's no problem 1736 /* The EMACS_INT cast avoids a warning. There's no problem
1737 as long as pointers have enough bits to hold small integers. */ 1737 as long as pointers have enough bits to hold small integers. */
1738 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); 1738 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
1739 wv->enabled = !NILP (enable); 1739 wv->enabled = !NILP (enable);
1740 1740
1741 if (NILP (type)) 1741 if (NILP (type))
1742 wv->button_type = BUTTON_TYPE_NONE; 1742 wv->button_type = BUTTON_TYPE_NONE;
1743 else if (EQ (type, QCradio)) 1743 else if (EQ (type, QCradio))
1744 wv->button_type = BUTTON_TYPE_RADIO; 1744 wv->button_type = BUTTON_TYPE_RADIO;
1745 else if (EQ (type, QCtoggle)) 1745 else if (EQ (type, QCtoggle))
1781 #ifdef USE_GTK 1781 #ifdef USE_GTK
1782 return xg_update_frame_menubar (f); 1782 return xg_update_frame_menubar (f);
1783 #else 1783 #else
1784 struct x_output *x = f->output_data.x; 1784 struct x_output *x = f->output_data.x;
1785 int columns, rows; 1785 int columns, rows;
1786 1786
1787 if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) 1787 if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
1788 return 0; 1788 return 0;
1789 1789
1790 BLOCK_INPUT; 1790 BLOCK_INPUT;
1791 /* Save the size of the frame because the pane widget doesn't accept 1791 /* Save the size of the frame because the pane widget doesn't accept
1845 #ifdef USE_X_TOOLKIT 1845 #ifdef USE_X_TOOLKIT
1846 if (f->output_data.x->id == 0) 1846 if (f->output_data.x->id == 0)
1847 f->output_data.x->id = next_menubar_widget_id++; 1847 f->output_data.x->id = next_menubar_widget_id++;
1848 id = f->output_data.x->id; 1848 id = f->output_data.x->id;
1849 #endif 1849 #endif
1850 1850
1851 if (! menubar_widget) 1851 if (! menubar_widget)
1852 deep_p = 1; 1852 deep_p = 1;
1853 else if (pending_menu_activation && !deep_p) 1853 else if (pending_menu_activation && !deep_p)
1854 deep_p = 1; 1854 deep_p = 1;
1855 /* Make the first call for any given frame always go deep. */ 1855 /* Make the first call for any given frame always go deep. */
1893 1893
1894 set_buffer_internal_1 (XBUFFER (buffer)); 1894 set_buffer_internal_1 (XBUFFER (buffer));
1895 1895
1896 /* Run the Lucid hook. */ 1896 /* Run the Lucid hook. */
1897 safe_run_hooks (Qactivate_menubar_hook); 1897 safe_run_hooks (Qactivate_menubar_hook);
1898 1898
1899 /* If it has changed current-menubar from previous value, 1899 /* If it has changed current-menubar from previous value,
1900 really recompute the menubar from the value. */ 1900 really recompute the menubar from the value. */
1901 if (! NILP (Vlucid_menu_bar_dirty_flag)) 1901 if (! NILP (Vlucid_menu_bar_dirty_flag))
1902 call0 (Qrecompute_lucid_menubar); 1902 call0 (Qrecompute_lucid_menubar);
1903 safe_run_hooks (Qmenu_bar_update_hook); 1903 safe_run_hooks (Qmenu_bar_update_hook);
1958 for (i = 0; i < last_i; i += 4) 1958 for (i = 0; i < last_i; i += 4)
1959 { 1959 {
1960 menu_items_n_panes = submenu_n_panes[i]; 1960 menu_items_n_panes = submenu_n_panes[i];
1961 wv = digest_single_submenu (submenu_start[i], submenu_end[i], 1961 wv = digest_single_submenu (submenu_start[i], submenu_end[i],
1962 submenu_top_level_items[i]); 1962 submenu_top_level_items[i]);
1963 if (prev_wv) 1963 if (prev_wv)
1964 prev_wv->next = wv; 1964 prev_wv->next = wv;
1965 else 1965 else
1966 first_wv->contents = wv; 1966 first_wv->contents = wv;
1967 /* Don't set wv->name here; GC during the loop might relocate it. */ 1967 /* Don't set wv->name here; GC during the loop might relocate it. */
1968 wv->enabled = 1; 1968 wv->enabled = 1;
2037 menu item is really supposed to be empty. */ 2037 menu item is really supposed to be empty. */
2038 /* The EMACS_INT cast avoids a warning. 2038 /* The EMACS_INT cast avoids a warning.
2039 This value just has to be different from small integers. */ 2039 This value just has to be different from small integers. */
2040 wv->call_data = (void *) (EMACS_INT) (-1); 2040 wv->call_data = (void *) (EMACS_INT) (-1);
2041 2041
2042 if (prev_wv) 2042 if (prev_wv)
2043 prev_wv->next = wv; 2043 prev_wv->next = wv;
2044 else 2044 else
2045 first_wv->contents = wv; 2045 first_wv->contents = wv;
2046 prev_wv = wv; 2046 prev_wv = wv;
2047 } 2047 }
2071 G_CALLBACK (menu_highlight_callback)); 2071 G_CALLBACK (menu_highlight_callback));
2072 } 2072 }
2073 else 2073 else
2074 { 2074 {
2075 GtkWidget *wvbox = f->output_data.x->vbox_widget; 2075 GtkWidget *wvbox = f->output_data.x->vbox_widget;
2076 2076
2077 menubar_widget 2077 menubar_widget
2078 = xg_create_widget ("menubar", "menubar", f, first_wv, 2078 = xg_create_widget ("menubar", "menubar", f, first_wv,
2079 G_CALLBACK (menubar_selection_callback), 2079 G_CALLBACK (menubar_selection_callback),
2080 G_CALLBACK (popup_deactivate_callback), 2080 G_CALLBACK (popup_deactivate_callback),
2081 G_CALLBACK (menu_highlight_callback)); 2081 G_CALLBACK (menu_highlight_callback));
2082 2082
2083 f->output_data.x->menubar_widget = menubar_widget; 2083 f->output_data.x->menubar_widget = menubar_widget;
2084 } 2084 }
2085 2085
2086 2086
2087 #else /* not USE_GTK */ 2087 #else /* not USE_GTK */
2088 if (menubar_widget) 2088 if (menubar_widget)
2089 { 2089 {
2090 /* Disable resizing (done for Motif!) */ 2090 /* Disable resizing (done for Motif!) */
2091 lw_allow_resizing (f->output_data.x->widget, False); 2091 lw_allow_resizing (f->output_data.x->widget, False);
2097 /* Re-enable the edit widget to resize. */ 2097 /* Re-enable the edit widget to resize. */
2098 lw_allow_resizing (f->output_data.x->widget, True); 2098 lw_allow_resizing (f->output_data.x->widget, True);
2099 } 2099 }
2100 else 2100 else
2101 { 2101 {
2102 menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, 2102 menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
2103 f->output_data.x->column_widget, 2103 f->output_data.x->column_widget,
2104 0, 2104 0,
2105 popup_activate_callback, 2105 popup_activate_callback,
2106 menubar_selection_callback, 2106 menubar_selection_callback,
2107 popup_deactivate_callback, 2107 popup_deactivate_callback,
2108 menu_highlight_callback); 2108 menu_highlight_callback);
2109 f->output_data.x->menubar_widget = menubar_widget; 2109 f->output_data.x->menubar_widget = menubar_widget;
2110 } 2110 }
2111 2111
2112 { 2112 {
2113 int menubar_size 2113 int menubar_size
2114 = (f->output_data.x->menubar_widget 2114 = (f->output_data.x->menubar_widget
2115 ? (f->output_data.x->menubar_widget->core.height 2115 ? (f->output_data.x->menubar_widget->core.height
2116 + f->output_data.x->menubar_widget->core.border_width) 2116 + f->output_data.x->menubar_widget->core.border_width)
2117 : 0); 2117 : 0);
2118 2118
2130 #endif /* 0 */ 2130 #endif /* 0 */
2131 2131
2132 f->output_data.x->menubar_height = menubar_size; 2132 f->output_data.x->menubar_height = menubar_size;
2133 } 2133 }
2134 #endif /* not USE_GTK */ 2134 #endif /* not USE_GTK */
2135 2135
2136 free_menubar_widget_value_tree (first_wv); 2136 free_menubar_widget_value_tree (first_wv);
2137 update_frame_menubar (f); 2137 update_frame_menubar (f);
2138 2138
2139 #ifdef USE_GTK 2139 #ifdef USE_GTK
2140 xg_crazy_callback_abort = 0; 2140 xg_crazy_callback_abort = 0;
2171 Widget menubar_widget; 2171 Widget menubar_widget;
2172 2172
2173 menubar_widget = f->output_data.x->menubar_widget; 2173 menubar_widget = f->output_data.x->menubar_widget;
2174 2174
2175 f->output_data.x->menubar_height = 0; 2175 f->output_data.x->menubar_height = 0;
2176 2176
2177 if (menubar_widget) 2177 if (menubar_widget)
2178 { 2178 {
2179 #ifdef USE_MOTIF 2179 #ifdef USE_MOTIF
2180 /* Removing the menu bar magically changes the shell widget's x 2180 /* Removing the menu bar magically changes the shell widget's x
2181 and y position of (0, 0) which, when the menu bar is turned 2181 and y position of (0, 0) which, when the menu bar is turned
2185 but not with other like Motif's mwm or kwm, because the 2185 but not with other like Motif's mwm or kwm, because the
2186 latter generate ConfigureNotify events when the menu bar 2186 latter generate ConfigureNotify events when the menu bar
2187 is switched off, which fixes the shell position. */ 2187 is switched off, which fixes the shell position. */
2188 Position x0, y0, x1, y1; 2188 Position x0, y0, x1, y1;
2189 #endif 2189 #endif
2190 2190
2191 BLOCK_INPUT; 2191 BLOCK_INPUT;
2192 2192
2193 #ifdef USE_MOTIF 2193 #ifdef USE_MOTIF
2194 if (f->output_data.x->widget) 2194 if (f->output_data.x->widget)
2195 XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL); 2195 XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL);
2196 #endif 2196 #endif
2197 2197
2198 lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id); 2198 lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
2199 f->output_data.x->menubar_widget = NULL; 2199 f->output_data.x->menubar_widget = NULL;
2200 2200
2201 #ifdef USE_MOTIF 2201 #ifdef USE_MOTIF
2202 if (f->output_data.x->widget) 2202 if (f->output_data.x->widget)
2204 XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL); 2204 XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
2205 if (x1 == 0 && y1 == 0) 2205 if (x1 == 0 && y1 == 0)
2206 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); 2206 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
2207 } 2207 }
2208 #endif 2208 #endif
2209 2209
2210 UNBLOCK_INPUT; 2210 UNBLOCK_INPUT;
2211 } 2211 }
2212 } 2212 }
2213 #endif /* not USE_GTK */ 2213 #endif /* not USE_GTK */
2214 2214
2298 menu = xg_create_widget ("popup", first_wv->name, f, first_wv, 2298 menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
2299 G_CALLBACK (popup_selection_callback), 2299 G_CALLBACK (popup_selection_callback),
2300 G_CALLBACK (popup_deactivate_callback), 2300 G_CALLBACK (popup_deactivate_callback),
2301 G_CALLBACK (menu_highlight_callback)); 2301 G_CALLBACK (menu_highlight_callback));
2302 xg_crazy_callback_abort = 0; 2302 xg_crazy_callback_abort = 0;
2303 2303
2304 for (i = 0; i < 5; i++) 2304 for (i = 0; i < 5; i++)
2305 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) 2305 if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
2306 break; 2306 break;
2307 2307
2308 if (! for_click) 2308 if (! for_click)
2319 } 2319 }
2320 2320
2321 /* Display the menu. */ 2321 /* Display the menu. */
2322 gtk_widget_show_all (menu); 2322 gtk_widget_show_all (menu);
2323 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); 2323 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
2324 2324
2325 xg_did_tearoff = 0; 2325 xg_did_tearoff = 0;
2326 /* Set this to one. popup_widget_loop increases it by one, so it becomes 2326 /* 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. */ 2327 two. show_help_echo uses this to detect popup menus. */
2328 popup_activated_flag = 1; 2328 popup_activated_flag = 1;
2329 /* Process events that apply to the menu. */ 2329 /* Process events that apply to the menu. */
2331 2331
2332 if (xg_did_tearoff) 2332 if (xg_did_tearoff)
2333 xg_keep_popup (menu, xg_did_tearoff); 2333 xg_keep_popup (menu, xg_did_tearoff);
2334 else 2334 else
2335 gtk_widget_destroy (menu); 2335 gtk_widget_destroy (menu);
2336 2336
2337 /* Must reset this manually because the button release event is not passed 2337 /* Must reset this manually because the button release event is not passed
2338 to Emacs event loop. */ 2338 to Emacs event loop. */
2339 FRAME_X_DISPLAY_INFO (f)->grabbed = 0; 2339 FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
2340 } 2340 }
2341 2341
2423 2423
2424 /* fp turned off the following statement and wrote a comment 2424 /* fp turned off the following statement and wrote a comment
2425 that it is unnecessary--that the menu has already disappeared. 2425 that it is unnecessary--that the menu has already disappeared.
2426 Nowadays the menu disappears ok, all right, but 2426 Nowadays the menu disappears ok, all right, but
2427 we need to delete the widgets or multiple ones will pile up. */ 2427 we need to delete the widgets or multiple ones will pile up. */
2428 lw_destroy_all_widgets (menu_id); 2428 lw_destroy_all_widgets (menu_id);
2429 } 2429 }
2430 2430
2431 #endif /* not USE_GTK */ 2431 #endif /* not USE_GTK */
2432 2432
2433 static Lisp_Object 2433 static Lisp_Object
2466 wv->enabled = 1; 2466 wv->enabled = 1;
2467 wv->button_type = BUTTON_TYPE_NONE; 2467 wv->button_type = BUTTON_TYPE_NONE;
2468 wv->help =Qnil; 2468 wv->help =Qnil;
2469 first_wv = wv; 2469 first_wv = wv;
2470 first_pane = 1; 2470 first_pane = 1;
2471 2471
2472 /* Loop over all panes and items, filling in the tree. */ 2472 /* Loop over all panes and items, filling in the tree. */
2473 i = 0; 2473 i = 0;
2474 while (i < menu_items_used) 2474 while (i < menu_items_used)
2475 { 2475 {
2476 if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) 2476 if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
2498 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) 2498 else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
2499 { 2499 {
2500 /* Create a new pane. */ 2500 /* Create a new pane. */
2501 Lisp_Object pane_name, prefix; 2501 Lisp_Object pane_name, prefix;
2502 char *pane_string; 2502 char *pane_string;
2503 2503
2504 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); 2504 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
2505 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); 2505 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
2506 2506
2507 #ifndef HAVE_MULTILINGUAL_MENU 2507 #ifndef HAVE_MULTILINGUAL_MENU
2508 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) 2508 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
2509 { 2509 {
2510 pane_name = ENCODE_SYSTEM (pane_name); 2510 pane_name = ENCODE_SYSTEM (pane_name);
2511 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; 2511 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
2562 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) 2562 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
2563 { 2563 {
2564 item_name = ENCODE_SYSTEM (item_name); 2564 item_name = ENCODE_SYSTEM (item_name);
2565 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; 2565 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
2566 } 2566 }
2567 2567
2568 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) 2568 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
2569 { 2569 {
2570 descrip = ENCODE_SYSTEM (descrip); 2570 descrip = ENCODE_SYSTEM (descrip);
2571 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; 2571 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
2572 } 2572 }
2573 #endif /* not HAVE_MULTILINGUAL_MENU */ 2573 #endif /* not HAVE_MULTILINGUAL_MENU */
2574 2574
2575 wv = xmalloc_widget_value (); 2575 wv = xmalloc_widget_value ();
2576 if (prev_wv) 2576 if (prev_wv)
2577 prev_wv->next = wv; 2577 prev_wv->next = wv;
2578 else 2578 else
2579 save_wv->contents = wv; 2579 save_wv->contents = wv;
2580 wv->name = (char *) SDATA (item_name); 2580 wv->name = (char *) SDATA (item_name);
2581 if (!NILP (descrip)) 2581 if (!NILP (descrip))
2582 wv->key = (char *) SDATA (descrip); 2582 wv->key = (char *) SDATA (descrip);
2583 wv->value = 0; 2583 wv->value = 0;
2627 2627
2628 #ifndef HAVE_MULTILINGUAL_MENU 2628 #ifndef HAVE_MULTILINGUAL_MENU
2629 if (STRING_MULTIBYTE (title)) 2629 if (STRING_MULTIBYTE (title))
2630 title = ENCODE_SYSTEM (title); 2630 title = ENCODE_SYSTEM (title);
2631 #endif 2631 #endif
2632 2632
2633 wv_title->name = (char *) SDATA (title); 2633 wv_title->name = (char *) SDATA (title);
2634 wv_title->enabled = TRUE; 2634 wv_title->enabled = TRUE;
2635 wv_title->button_type = BUTTON_TYPE_NONE; 2635 wv_title->button_type = BUTTON_TYPE_NONE;
2636 wv_title->next = wv_sep1; 2636 wv_title->next = wv_sep1;
2637 wv_title->help = Qnil; 2637 wv_title->help = Qnil;
2739 /* Display the menu. */ 2739 /* Display the menu. */
2740 gtk_widget_show_all (menu); 2740 gtk_widget_show_all (menu);
2741 2741
2742 /* Process events that apply to the menu. */ 2742 /* Process events that apply to the menu. */
2743 popup_widget_loop (); 2743 popup_widget_loop ();
2744 2744
2745 gtk_widget_destroy (menu); 2745 gtk_widget_destroy (menu);
2746 } 2746 }
2747 } 2747 }
2748 2748
2749 #else /* not USE_GTK */ 2749 #else /* not USE_GTK */
2805 /* Process events that apply to the dialog box. 2805 /* Process events that apply to the dialog box.
2806 Also handle timers. */ 2806 Also handle timers. */
2807 { 2807 {
2808 int count = SPECPDL_INDEX (); 2808 int count = SPECPDL_INDEX ();
2809 int fact = 4 * sizeof (LWLIB_ID); 2809 int fact = 4 * sizeof (LWLIB_ID);
2810 2810
2811 /* xdialog_show_unwind is responsible for popping the dialog box down. */ 2811 /* xdialog_show_unwind is responsible for popping the dialog box down. */
2812 record_unwind_protect (xdialog_show_unwind, 2812 record_unwind_protect (xdialog_show_unwind,
2813 Fcons (make_number (dialog_id >> (fact)), 2813 Fcons (make_number (dialog_id >> (fact)),
2814 make_number (dialog_id & ~(-1 << (fact))))); 2814 make_number (dialog_id & ~(-1 << (fact)))));
2815 2815
2856 Lisp_Object pane_name, prefix; 2856 Lisp_Object pane_name, prefix;
2857 char *pane_string; 2857 char *pane_string;
2858 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; 2858 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
2859 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; 2859 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
2860 pane_string = (NILP (pane_name) 2860 pane_string = (NILP (pane_name)
2861 ? "" : (char *) SDATA (pane_name)); 2861 ? "" : (char *) SDATA (pane_name));
2862 prev_wv = xmalloc_widget_value (); 2862 prev_wv = xmalloc_widget_value ();
2863 prev_wv->value = pane_string; 2863 prev_wv->value = pane_string;
2864 if (keymaps && !NILP (prefix)) 2864 if (keymaps && !NILP (prefix))
2865 prev_wv->name++; 2865 prev_wv->name++;
2866 prev_wv->enabled = 1; 2866 prev_wv->enabled = 1;
2867 prev_wv->name = "message"; 2867 prev_wv->name = "message";
2868 prev_wv->help = Qnil; 2868 prev_wv->help = Qnil;
2869 first_wv = prev_wv; 2869 first_wv = prev_wv;
2870 2870
2871 /* Loop over all panes and items, filling in the tree. */ 2871 /* Loop over all panes and items, filling in the tree. */
2872 i = MENU_ITEMS_PANE_LENGTH; 2872 i = MENU_ITEMS_PANE_LENGTH;
2873 while (i < menu_items_used) 2873 while (i < menu_items_used)
2874 { 2874 {
2875 2875
2876 /* Create a new item within current pane. */ 2876 /* Create a new item within current pane. */
2877 Lisp_Object item_name, enable, descrip; 2877 Lisp_Object item_name, enable, descrip;
2878 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; 2878 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
2879 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; 2879 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
2880 descrip 2880 descrip
2881 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; 2881 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
2882 2882
2883 if (NILP (item_name)) 2883 if (NILP (item_name))
2884 { 2884 {
2885 free_menubar_widget_value_tree (first_wv); 2885 free_menubar_widget_value_tree (first_wv);
2886 *error = "Submenu in dialog items"; 2886 *error = "Submenu in dialog items";
2887 return Qnil; 2887 return Qnil;
2948 /* Actually create and show the dialog. */ 2948 /* Actually create and show the dialog. */
2949 create_and_show_dialog (f, first_wv); 2949 create_and_show_dialog (f, first_wv);
2950 2950
2951 /* Free the widget_value objects we used to specify the contents. */ 2951 /* Free the widget_value objects we used to specify the contents. */
2952 free_menubar_widget_value_tree (first_wv); 2952 free_menubar_widget_value_tree (first_wv);
2953 2953
2954 /* Find the selected item, and its pane, to return 2954 /* Find the selected item, and its pane, to return
2955 the proper value. */ 2955 the proper value. */
2956 if (menu_item_selection != 0) 2956 if (menu_item_selection != 0)
2957 { 2957 {
2958 Lisp_Object prefix; 2958 Lisp_Object prefix;
3007 3007
3008 /* Show help HELP_STRING, or clear help if HELP_STRING is null. 3008 /* Show help HELP_STRING, or clear help if HELP_STRING is null.
3009 3009
3010 PANE is the pane number, and ITEM is the menu item number in 3010 PANE is the pane number, and ITEM is the menu item number in
3011 the menu (currently not used). 3011 the menu (currently not used).
3012 3012
3013 This cannot be done with generating a HELP_EVENT because 3013 This cannot be done with generating a HELP_EVENT because
3014 XMenuActivate contains a loop that doesn't let Emacs process 3014 XMenuActivate contains a loop that doesn't let Emacs process
3015 keyboard events. */ 3015 keyboard events. */
3016 3016
3017 static void 3017 static void
3021 { 3021 {
3022 extern Lisp_Object Qmenu_item; 3022 extern Lisp_Object Qmenu_item;
3023 Lisp_Object *first_item; 3023 Lisp_Object *first_item;
3024 Lisp_Object pane_name; 3024 Lisp_Object pane_name;
3025 Lisp_Object menu_object; 3025 Lisp_Object menu_object;
3026 3026
3027 first_item = XVECTOR (menu_items)->contents; 3027 first_item = XVECTOR (menu_items)->contents;
3028 if (EQ (first_item[0], Qt)) 3028 if (EQ (first_item[0], Qt))
3029 pane_name = first_item[MENU_ITEMS_PANE_NAME]; 3029 pane_name = first_item[MENU_ITEMS_PANE_NAME];
3030 else if (EQ (first_item[0], Qquote)) 3030 else if (EQ (first_item[0], Qquote))
3031 /* This shouldn't happen, see xmenu_show. */ 3031 /* This shouldn't happen, see xmenu_show. */
3032 pane_name = empty_string; 3032 pane_name = empty_string;
3033 else 3033 else
3034 pane_name = first_item[MENU_ITEMS_ITEM_NAME]; 3034 pane_name = first_item[MENU_ITEMS_ITEM_NAME];
3035 3035
3036 /* (menu-item MENU-NAME PANE-NUMBER) */ 3036 /* (menu-item MENU-NAME PANE-NUMBER) */
3037 menu_object = Fcons (Qmenu_item, 3037 menu_object = Fcons (Qmenu_item,
3038 Fcons (pane_name, 3038 Fcons (pane_name,
3039 Fcons (make_number (pane), Qnil))); 3039 Fcons (make_number (pane), Qnil)));
3040 show_help_echo (help_string ? build_string (help_string) : Qnil, 3040 show_help_echo (help_string ? build_string (help_string) : Qnil,
3041 Qnil, menu_object, make_number (item), 1); 3041 Qnil, menu_object, make_number (item), 1);
3042 } 3042 }
3043 3043
3044 3044
3045 static Lisp_Object 3045 static Lisp_Object
3046 xmenu_show (f, x, y, for_click, keymaps, title, error) 3046 xmenu_show (f, x, y, for_click, keymaps, title, error)
3047 FRAME_PTR f; 3047 FRAME_PTR f;
3048 int x, y; 3048 int x, y;
3049 int for_click; 3049 int for_click;
3050 int keymaps; 3050 int keymaps;
3051 Lisp_Object title; 3051 Lisp_Object title;
3052 char **error; 3052 char **error;
3053 { 3053 {
3054 Window root; 3054 Window root;
3055 XMenu *menu; 3055 XMenu *menu;
3056 int pane, selidx, lpane, status; 3056 int pane, selidx, lpane, status;
3057 Lisp_Object entry, pane_prefix; 3057 Lisp_Object entry, pane_prefix;
3058 char *datap; 3058 char *datap;
3059 int ulx, uly, width, height; 3059 int ulx, uly, width, height;
3116 #endif /* HAVE_X_WINDOWS */ 3116 #endif /* HAVE_X_WINDOWS */
3117 3117
3118 /* Adjust coordinates to be root-window-relative. */ 3118 /* Adjust coordinates to be root-window-relative. */
3119 x += f->output_data.x->left_pos; 3119 x += f->output_data.x->left_pos;
3120 y += f->output_data.x->top_pos; 3120 y += f->output_data.x->top_pos;
3121 3121
3122 /* Create all the necessary panes and their items. */ 3122 /* Create all the necessary panes and their items. */
3123 i = 0; 3123 i = 0;
3124 while (i < menu_items_used) 3124 while (i < menu_items_used)
3125 { 3125 {
3126 if (EQ (XVECTOR (menu_items)->contents[i], Qt)) 3126 if (EQ (XVECTOR (menu_items)->contents[i], Qt))
3181 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; 3181 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
3182 descrip 3182 descrip
3183 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; 3183 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
3184 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; 3184 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
3185 help_string = STRINGP (help) ? SDATA (help) : NULL; 3185 help_string = STRINGP (help) ? SDATA (help) : NULL;
3186 3186
3187 if (!NILP (descrip)) 3187 if (!NILP (descrip))
3188 { 3188 {
3189 int gap = maxwidth - SBYTES (item_name); 3189 int gap = maxwidth - SBYTES (item_name);
3190 #ifdef C_ALLOCA 3190 #ifdef C_ALLOCA
3191 Lisp_Object spacer; 3191 Lisp_Object spacer;
3345 doc: /* Frame for which we are updating a menu. 3345 doc: /* Frame for which we are updating a menu.
3346 The enable predicate for a menu command should check this variable. */); 3346 The enable predicate for a menu command should check this variable. */);
3347 Vmenu_updating_frame = Qnil; 3347 Vmenu_updating_frame = Qnil;
3348 3348
3349 #ifdef USE_X_TOOLKIT 3349 #ifdef USE_X_TOOLKIT
3350 widget_id_tick = (1<<16); 3350 widget_id_tick = (1<<16);
3351 next_menubar_widget_id = 1; 3351 next_menubar_widget_id = 1;
3352 #endif 3352 #endif
3353 3353
3354 defsubr (&Sx_popup_menu); 3354 defsubr (&Sx_popup_menu);
3355 #ifdef HAVE_MENUS 3355 #ifdef HAVE_MENUS