Mercurial > emacs
comparison src/xmenu.c @ 24993:825f11b1c34d
Ditto.
(xmenu_show) [LESSTIF_VERSION]: Add workaround for remaining
button grab under LessTif
(HAVE_BOXES): Define if USE_X_TOOLKIT.
(HAVE_BOXES): Define if using Lucid menus.
(single_submenu): Set button_type of menu to
BUTTON_TYPE_NONE.
(single_submenu): Likewise for panes and menu items.
(set_frame_menubar): Set button_type of menu bar to none.
(xmenu_show): Likewise.
(single_submenu): Set widget values selected slot.
(xmenu_show): Likewise.
(push_menu_item): Add parameters `type' and
`selected'. Store it in menu_items.
(MENU_ITEMS_ITEM_TYPE): New.
(MENU_ITEMS_ITEM_SELECTED): New.
(MENU_ITEMS_ITEM_LENGTH): Increase by two.
(popup_get_selection): Use xmalloc/xfree instead of
malloc/free.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 21 Jul 1999 21:43:52 +0000 |
parents | dcff2a4b6cb4 |
children | 824b89fca192 |
comparison
equal
deleted
inserted
replaced
24992:f1632be03391 | 24993:825f11b1c34d |
---|---|
76 #else /* not USE_X_TOOLKIT */ | 76 #else /* not USE_X_TOOLKIT */ |
77 #include "../oldXMenu/XMenu.h" | 77 #include "../oldXMenu/XMenu.h" |
78 #endif /* not USE_X_TOOLKIT */ | 78 #endif /* not USE_X_TOOLKIT */ |
79 #endif /* HAVE_X_WINDOWS */ | 79 #endif /* HAVE_X_WINDOWS */ |
80 | 80 |
81 #ifdef USE_MOTIF | |
82 #include <Xm/Xm.h> /* for LESSTIF_VERSION */ | |
83 #endif | |
84 | |
81 #define min(x,y) (((x) < (y)) ? (x) : (y)) | 85 #define min(x,y) (((x) < (y)) ? (x) : (y)) |
82 #define max(x,y) (((x) > (y)) ? (x) : (y)) | 86 #define max(x,y) (((x) > (y)) ? (x) : (y)) |
83 | 87 |
84 #ifndef TRUE | 88 #ifndef TRUE |
85 #define TRUE 1 | 89 #define TRUE 1 |
109 | 113 |
110 static Lisp_Object xdialog_show (); | 114 static Lisp_Object xdialog_show (); |
111 void popup_get_selection (); | 115 void popup_get_selection (); |
112 #endif | 116 #endif |
113 | 117 |
118 #ifdef USE_X_TOOLKIT | |
119 | |
120 /* Define HAVE_BOXES if meus can handle radio and toggle buttons. */ | |
121 | |
122 #define HAVE_BOXES 1 | |
123 #endif | |
124 | |
125 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | |
126 Lisp_Object, Lisp_Object, Lisp_Object, | |
127 Lisp_Object)); | |
114 static Lisp_Object xmenu_show (); | 128 static Lisp_Object xmenu_show (); |
115 static void keymap_panes (); | 129 static void keymap_panes (); |
116 static void single_keymap_panes (); | 130 static void single_keymap_panes (); |
117 static void single_menu_item (); | 131 static void single_menu_item (); |
118 static void list_of_panes (); | 132 static void list_of_panes (); |
147 #define MENU_ITEMS_ITEM_NAME 0 | 161 #define MENU_ITEMS_ITEM_NAME 0 |
148 #define MENU_ITEMS_ITEM_ENABLE 1 | 162 #define MENU_ITEMS_ITEM_ENABLE 1 |
149 #define MENU_ITEMS_ITEM_VALUE 2 | 163 #define MENU_ITEMS_ITEM_VALUE 2 |
150 #define MENU_ITEMS_ITEM_EQUIV_KEY 3 | 164 #define MENU_ITEMS_ITEM_EQUIV_KEY 3 |
151 #define MENU_ITEMS_ITEM_DEFINITION 4 | 165 #define MENU_ITEMS_ITEM_DEFINITION 4 |
152 #define MENU_ITEMS_ITEM_LENGTH 5 | 166 #define MENU_ITEMS_ITEM_TYPE 5 |
167 #define MENU_ITEMS_ITEM_SELECTED 6 | |
168 #define MENU_ITEMS_ITEM_LENGTH 7 | |
153 | 169 |
154 static Lisp_Object menu_items; | 170 static Lisp_Object menu_items; |
155 | 171 |
156 /* Number of slots currently allocated in menu_items. */ | 172 /* Number of slots currently allocated in menu_items. */ |
157 static int menu_items_allocated; | 173 static int menu_items_allocated; |
313 XVECTOR (menu_items)->contents[menu_items_used++] = Qt; | 329 XVECTOR (menu_items)->contents[menu_items_used++] = Qt; |
314 XVECTOR (menu_items)->contents[menu_items_used++] = name; | 330 XVECTOR (menu_items)->contents[menu_items_used++] = name; |
315 XVECTOR (menu_items)->contents[menu_items_used++] = prefix_vec; | 331 XVECTOR (menu_items)->contents[menu_items_used++] = prefix_vec; |
316 } | 332 } |
317 | 333 |
318 /* Push one menu item into the current pane. | 334 /* Push one menu item into the current pane. NAME is the string to |
319 NAME is the string to display. ENABLE if non-nil means | 335 display. ENABLE if non-nil means this item can be selected. KEY |
320 this item can be selected. KEY is the key generated by | 336 is the key generated by choosing this item, or nil if this item |
321 choosing this item, or nil if this item doesn't really have a definition. | 337 doesn't really have a definition. DEF is the definition of this |
322 DEF is the definition of this item. | 338 item. EQUIV is the textual description of the keyboard equivalent |
323 EQUIV is the textual description of the keyboard equivalent for | 339 for this item (or nil if none). TYPE is the type of this menu |
324 this item (or nil if none). */ | 340 item, one of nil, `toggle' or `radio'. */ |
325 | 341 |
326 static void | 342 static void |
327 push_menu_item (name, enable, key, def, equiv) | 343 push_menu_item (name, enable, key, def, equiv, type, selected) |
328 Lisp_Object name, enable, key, def, equiv; | 344 Lisp_Object name, enable, key, def, equiv, type, selected; |
329 { | 345 { |
330 if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) | 346 if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) |
331 grow_menu_items (); | 347 grow_menu_items (); |
332 | 348 |
333 XVECTOR (menu_items)->contents[menu_items_used++] = name; | 349 XVECTOR (menu_items)->contents[menu_items_used++] = name; |
334 XVECTOR (menu_items)->contents[menu_items_used++] = enable; | 350 XVECTOR (menu_items)->contents[menu_items_used++] = enable; |
335 XVECTOR (menu_items)->contents[menu_items_used++] = key; | 351 XVECTOR (menu_items)->contents[menu_items_used++] = key; |
336 XVECTOR (menu_items)->contents[menu_items_used++] = equiv; | 352 XVECTOR (menu_items)->contents[menu_items_used++] = equiv; |
337 XVECTOR (menu_items)->contents[menu_items_used++] = def; | 353 XVECTOR (menu_items)->contents[menu_items_used++] = def; |
354 XVECTOR (menu_items)->contents[menu_items_used++] = type; | |
355 XVECTOR (menu_items)->contents[menu_items_used++] = selected; | |
338 } | 356 } |
339 | 357 |
340 /* Look through KEYMAPS, a vector of keymaps that is NMAPS long, | 358 /* Look through KEYMAPS, a vector of keymaps that is NMAPS long, |
341 and generate menu panes for them in menu_items. | 359 and generate menu panes for them in menu_items. |
342 If NOTREAL is nonzero, | 360 If NOTREAL is nonzero, |
559 item_string = concat2 (item_string, build_string (" >")); | 577 item_string = concat2 (item_string, build_string (" >")); |
560 #endif | 578 #endif |
561 | 579 |
562 push_menu_item (item_string, enabled, key, | 580 push_menu_item (item_string, enabled, key, |
563 XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF], | 581 XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF], |
564 XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ]); | 582 XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ], |
583 XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE], | |
584 XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED]); | |
565 | 585 |
566 #ifdef USE_X_TOOLKIT | 586 #ifdef USE_X_TOOLKIT |
567 /* Display a submenu using the toolkit. */ | 587 /* Display a submenu using the toolkit. */ |
568 if (! (NILP (map) || NILP (enabled))) | 588 if (! (NILP (map) || NILP (enabled))) |
569 { | 589 { |
611 | 631 |
612 for (tail = pane; !NILP (tail); tail = Fcdr (tail)) | 632 for (tail = pane; !NILP (tail); tail = Fcdr (tail)) |
613 { | 633 { |
614 item = Fcar (tail); | 634 item = Fcar (tail); |
615 if (STRINGP (item)) | 635 if (STRINGP (item)) |
616 push_menu_item (item, Qnil, Qnil, Qt, Qnil); | 636 push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil); |
617 else if (NILP (item)) | 637 else if (NILP (item)) |
618 push_left_right_boundary (); | 638 push_left_right_boundary (); |
619 else | 639 else |
620 { | 640 { |
621 CHECK_CONS (item, 0); | 641 CHECK_CONS (item, 0); |
622 item1 = Fcar (item); | 642 item1 = Fcar (item); |
623 CHECK_STRING (item1, 1); | 643 CHECK_STRING (item1, 1); |
624 push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil); | 644 push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil); |
625 } | 645 } |
626 } | 646 } |
627 } | 647 } |
628 | 648 |
629 DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, | 649 DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, |
1317 { | 1337 { |
1318 /* Here we have a command at top level in the menu bar | 1338 /* Here we have a command at top level in the menu bar |
1319 as opposed to a submenu. */ | 1339 as opposed to a submenu. */ |
1320 top_level_items = 1; | 1340 top_level_items = 1; |
1321 push_menu_pane (Qnil, Qnil); | 1341 push_menu_pane (Qnil, Qnil); |
1322 push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil); | 1342 push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil, Qnil, Qnil); |
1323 } | 1343 } |
1324 else | 1344 else |
1325 single_keymap_panes (mapvec[i], item_name, item_key, 0, 10); | 1345 single_keymap_panes (mapvec[i], item_name, item_key, 0, 10); |
1326 } | 1346 } |
1327 | 1347 |
1332 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); | 1352 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); |
1333 wv = xmalloc_widget_value (); | 1353 wv = xmalloc_widget_value (); |
1334 wv->name = "menu"; | 1354 wv->name = "menu"; |
1335 wv->value = 0; | 1355 wv->value = 0; |
1336 wv->enabled = 1; | 1356 wv->enabled = 1; |
1357 wv->button_type = BUTTON_TYPE_NONE; | |
1337 first_wv = wv; | 1358 first_wv = wv; |
1338 save_wv = 0; | 1359 save_wv = 0; |
1339 prev_wv = 0; | 1360 prev_wv = 0; |
1340 | 1361 |
1341 /* Loop over all panes and items made during this call | 1362 /* Loop over all panes and items made during this call |
1398 This is a kludge, but this isn't worth more time. */ | 1419 This is a kludge, but this isn't worth more time. */ |
1399 if (!NILP (prefix) && wv->name[0] == '@') | 1420 if (!NILP (prefix) && wv->name[0] == '@') |
1400 wv->name++; | 1421 wv->name++; |
1401 wv->value = 0; | 1422 wv->value = 0; |
1402 wv->enabled = 1; | 1423 wv->enabled = 1; |
1424 wv->button_type = BUTTON_TYPE_NONE; | |
1403 } | 1425 } |
1404 save_wv = wv; | 1426 save_wv = wv; |
1405 prev_wv = 0; | 1427 prev_wv = 0; |
1406 i += MENU_ITEMS_PANE_LENGTH; | 1428 i += MENU_ITEMS_PANE_LENGTH; |
1407 } | 1429 } |
1408 else | 1430 else |
1409 { | 1431 { |
1410 /* Create a new item within current pane. */ | 1432 /* Create a new item within current pane. */ |
1411 Lisp_Object item_name, enable, descrip, def; | 1433 Lisp_Object item_name, enable, descrip, def, type, selected; |
1412 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; | 1434 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; |
1413 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; | 1435 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; |
1414 descrip | 1436 descrip |
1415 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 1437 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
1416 def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 1438 def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; |
1439 type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE]; | |
1440 selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED]; | |
1441 | |
1417 #ifndef HAVE_MULTILINGUAL_MENU | 1442 #ifndef HAVE_MULTILINGUAL_MENU |
1418 if (STRING_MULTIBYTE (item_name)) | 1443 if (STRING_MULTIBYTE (item_name)) |
1419 item_name = string_make_unibyte (item_name); | 1444 item_name = string_make_unibyte (item_name); |
1420 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 1445 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
1421 descrip = string_make_unibyte (descrip); | 1446 descrip = string_make_unibyte (descrip); |
1422 #endif | 1447 #endif |
1448 | |
1423 wv = xmalloc_widget_value (); | 1449 wv = xmalloc_widget_value (); |
1424 if (prev_wv) | 1450 if (prev_wv) |
1425 prev_wv->next = wv; | 1451 prev_wv->next = wv; |
1426 else | 1452 else |
1427 save_wv->contents = wv; | 1453 save_wv->contents = wv; |
1432 wv->value = 0; | 1458 wv->value = 0; |
1433 /* The EMACS_INT cast avoids a warning. There's no problem | 1459 /* The EMACS_INT cast avoids a warning. There's no problem |
1434 as long as pointers have enough bits to hold small integers. */ | 1460 as long as pointers have enough bits to hold small integers. */ |
1435 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); | 1461 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); |
1436 wv->enabled = !NILP (enable); | 1462 wv->enabled = !NILP (enable); |
1463 | |
1464 if (NILP (type)) | |
1465 wv->button_type = BUTTON_TYPE_NONE; | |
1466 else if (EQ (type, QCradio)) | |
1467 wv->button_type = BUTTON_TYPE_RADIO; | |
1468 else if (EQ (type, QCtoggle)) | |
1469 wv->button_type = BUTTON_TYPE_TOGGLE; | |
1470 else | |
1471 abort (); | |
1472 | |
1473 wv->selected = !NILP (selected); | |
1474 | |
1437 prev_wv = wv; | 1475 prev_wv = wv; |
1438 | 1476 |
1439 i += MENU_ITEMS_ITEM_LENGTH; | 1477 i += MENU_ITEMS_ITEM_LENGTH; |
1440 } | 1478 } |
1441 } | 1479 } |
1549 | 1587 |
1550 wv = xmalloc_widget_value (); | 1588 wv = xmalloc_widget_value (); |
1551 wv->name = "menubar"; | 1589 wv->name = "menubar"; |
1552 wv->value = 0; | 1590 wv->value = 0; |
1553 wv->enabled = 1; | 1591 wv->enabled = 1; |
1592 wv->button_type = BUTTON_TYPE_NONE; | |
1554 first_wv = wv; | 1593 first_wv = wv; |
1555 | 1594 |
1556 if (deep_p) | 1595 if (deep_p) |
1557 { | 1596 { |
1558 /* Make a widget-value tree representing the entire menu trees. */ | 1597 /* Make a widget-value tree representing the entire menu trees. */ |
1621 prev_wv->next = wv; | 1660 prev_wv->next = wv; |
1622 else | 1661 else |
1623 first_wv->contents = wv; | 1662 first_wv->contents = wv; |
1624 /* Don't set wv->name here; GC during the loop might relocate it. */ | 1663 /* Don't set wv->name here; GC during the loop might relocate it. */ |
1625 wv->enabled = 1; | 1664 wv->enabled = 1; |
1665 wv->button_type = BUTTON_TYPE_NONE; | |
1626 prev_wv = wv; | 1666 prev_wv = wv; |
1627 } | 1667 } |
1628 | 1668 |
1629 finish_menu_items (); | 1669 finish_menu_items (); |
1630 | 1670 |
1679 | 1719 |
1680 wv = xmalloc_widget_value (); | 1720 wv = xmalloc_widget_value (); |
1681 wv->name = (char *) XSTRING (string)->data; | 1721 wv->name = (char *) XSTRING (string)->data; |
1682 wv->value = 0; | 1722 wv->value = 0; |
1683 wv->enabled = 1; | 1723 wv->enabled = 1; |
1724 wv->button_type = BUTTON_TYPE_NONE; | |
1684 /* This prevents lwlib from assuming this | 1725 /* This prevents lwlib from assuming this |
1685 menu item is really supposed to be empty. */ | 1726 menu item is really supposed to be empty. */ |
1686 /* The EMACS_INT cast avoids a warning. | 1727 /* The EMACS_INT cast avoids a warning. |
1687 This value just has to be different from small integers. */ | 1728 This value just has to be different from small integers. */ |
1688 wv->call_data = (void *) (EMACS_INT) (-1); | 1729 wv->call_data = (void *) (EMACS_INT) (-1); |
1877 representing the panes and their items. */ | 1918 representing the panes and their items. */ |
1878 wv = xmalloc_widget_value (); | 1919 wv = xmalloc_widget_value (); |
1879 wv->name = "menu"; | 1920 wv->name = "menu"; |
1880 wv->value = 0; | 1921 wv->value = 0; |
1881 wv->enabled = 1; | 1922 wv->enabled = 1; |
1923 wv->button_type = BUTTON_TYPE_NONE; | |
1882 first_wv = wv; | 1924 first_wv = wv; |
1883 first_pane = 1; | 1925 first_pane = 1; |
1884 | 1926 |
1885 /* Loop over all panes and items, filling in the tree. */ | 1927 /* Loop over all panes and items, filling in the tree. */ |
1886 i = 0; | 1928 i = 0; |
1939 wv->name = pane_string; | 1981 wv->name = pane_string; |
1940 if (keymaps && !NILP (prefix)) | 1982 if (keymaps && !NILP (prefix)) |
1941 wv->name++; | 1983 wv->name++; |
1942 wv->value = 0; | 1984 wv->value = 0; |
1943 wv->enabled = 1; | 1985 wv->enabled = 1; |
1986 wv->button_type = BUTTON_TYPE_NONE; | |
1944 save_wv = wv; | 1987 save_wv = wv; |
1945 prev_wv = 0; | 1988 prev_wv = 0; |
1946 } | 1989 } |
1947 else if (first_pane) | 1990 else if (first_pane) |
1948 { | 1991 { |
1953 i += MENU_ITEMS_PANE_LENGTH; | 1996 i += MENU_ITEMS_PANE_LENGTH; |
1954 } | 1997 } |
1955 else | 1998 else |
1956 { | 1999 { |
1957 /* Create a new item within current pane. */ | 2000 /* Create a new item within current pane. */ |
1958 Lisp_Object item_name, enable, descrip, def; | 2001 Lisp_Object item_name, enable, descrip, def, type, selected; |
1959 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; | 2002 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; |
1960 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; | 2003 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; |
1961 descrip | 2004 descrip |
1962 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 2005 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
1963 def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 2006 def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; |
2007 type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE]; | |
2008 selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED]; | |
2009 | |
1964 #ifndef HAVE_MULTILINGUAL_MENU | 2010 #ifndef HAVE_MULTILINGUAL_MENU |
1965 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) | 2011 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
1966 item_name = string_make_unibyte (item_name); | 2012 item_name = string_make_unibyte (item_name); |
1967 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 2013 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
1968 item_name = string_make_unibyte (descrip); | 2014 item_name = string_make_unibyte (descrip); |
1969 #endif | 2015 #endif |
1970 | 2016 |
1971 wv = xmalloc_widget_value (); | 2017 wv = xmalloc_widget_value (); |
1972 if (prev_wv) | 2018 if (prev_wv) |
1973 prev_wv->next = wv; | 2019 prev_wv->next = wv; |
1974 else | 2020 else |
1975 save_wv->contents = wv; | 2021 save_wv->contents = wv; |
1981 make the call_data null so that it won't display a box | 2027 make the call_data null so that it won't display a box |
1982 when the mouse is on it. */ | 2028 when the mouse is on it. */ |
1983 wv->call_data | 2029 wv->call_data |
1984 = (!NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0); | 2030 = (!NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0); |
1985 wv->enabled = !NILP (enable); | 2031 wv->enabled = !NILP (enable); |
2032 | |
2033 if (NILP (type)) | |
2034 wv->button_type = BUTTON_TYPE_NONE; | |
2035 else if (EQ (type, QCtoggle)) | |
2036 wv->button_type = BUTTON_TYPE_TOGGLE; | |
2037 else if (EQ (type, QCradio)) | |
2038 wv->button_type = BUTTON_TYPE_RADIO; | |
2039 else | |
2040 abort (); | |
2041 | |
2042 wv->selected = !NILP (selected); | |
2043 | |
1986 prev_wv = wv; | 2044 prev_wv = wv; |
1987 | 2045 |
1988 i += MENU_ITEMS_ITEM_LENGTH; | 2046 i += MENU_ITEMS_ITEM_LENGTH; |
1989 } | 2047 } |
1990 } | 2048 } |
2006 if (STRING_MULTIBYTE (title)) | 2064 if (STRING_MULTIBYTE (title)) |
2007 title = string_make_unibyte (title); | 2065 title = string_make_unibyte (title); |
2008 #endif | 2066 #endif |
2009 wv_title->name = (char *) XSTRING (title)->data; | 2067 wv_title->name = (char *) XSTRING (title)->data; |
2010 wv_title->enabled = True; | 2068 wv_title->enabled = True; |
2069 wv_title->button_type = BUTTON_TYPE_NONE; | |
2011 wv_title->next = wv_sep1; | 2070 wv_title->next = wv_sep1; |
2012 first_wv->contents = wv_title; | 2071 first_wv->contents = wv_title; |
2013 } | 2072 } |
2014 | 2073 |
2015 /* Actually create the menu. */ | 2074 /* Actually create the menu. */ |
2082 lw_popup_menu (menu, &dummy); | 2141 lw_popup_menu (menu, &dummy); |
2083 popup_activated_flag = 1; | 2142 popup_activated_flag = 1; |
2084 | 2143 |
2085 /* Process events that apply to the menu. */ | 2144 /* Process events that apply to the menu. */ |
2086 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id); | 2145 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id); |
2146 | |
2147 #ifdef LESSTIF_VERSION | |
2148 /* Nov 1998: For an unknown reason a button grab remains active | |
2149 after the popup menu has gone. */ | |
2150 XUngrabButton (XtDisplay (f->output_data.x->widget), | |
2151 AnyButton, AnyModifier, | |
2152 XtWindow (f->output_data.x->widget)); | |
2153 XUngrabButton (XtDisplay (f->output_data.x->edit_widget), | |
2154 AnyButton, AnyModifier, | |
2155 XtWindow (f->output_data.x->edit_widget)); | |
2156 #endif /* LESSTIF_VERSION */ | |
2087 | 2157 |
2088 /* fp turned off the following statement and wrote a comment | 2158 /* fp turned off the following statement and wrote a comment |
2089 that it is unnecessary--that the menu has already disappeared. | 2159 that it is unnecessary--that the menu has already disappeared. |
2090 Nowadays the menu disappears ok, all right, but | 2160 Nowadays the menu disappears ok, all right, but |
2091 we need to delete the widgets or multiple ones will pile up. */ | 2161 we need to delete the widgets or multiple ones will pile up. */ |