diff options
| author | Dave Love | 2003-06-02 18:48:43 +0000 |
|---|---|---|
| committer | Dave Love | 2003-06-02 18:48:43 +0000 |
| commit | 646f98ec214c9afc033536b0aba0a7617a786a16 (patch) | |
| tree | f636a2313b8dc6adac7291ed278955923965a8c3 /src | |
| parent | 776a24a1766c5f9d3cd9d85336ae71ae1ddd5014 (diff) | |
| download | emacs-646f98ec214c9afc033536b0aba0a7617a786a16.tar.gz emacs-646f98ec214c9afc033536b0aba0a7617a786a16.zip | |
(ENCODE_MENU_STRING): New.
(list_of_panes, list_of_items, digest_single_submenu, xmenu_show):
Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index daafad6140a..dd4880aaa4c 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -68,6 +68,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 68 | #include "dispextern.h" | 68 | #include "dispextern.h" |
| 69 | 69 | ||
| 70 | #ifdef HAVE_X_WINDOWS | 70 | #ifdef HAVE_X_WINDOWS |
| 71 | /* Defining HAVE_MULTILINGUAL_MENU would mean that the toolkit menu | ||
| 72 | code accepts the Emacs internal encoding. */ | ||
| 71 | #undef HAVE_MULTILINGUAL_MENU | 73 | #undef HAVE_MULTILINGUAL_MENU |
| 72 | #ifdef USE_X_TOOLKIT | 74 | #ifdef USE_X_TOOLKIT |
| 73 | #include "widget.h" | 75 | #include "widget.h" |
| @@ -127,6 +129,22 @@ extern void set_frame_menubar (); | |||
| 127 | static Lisp_Object xdialog_show (); | 129 | static Lisp_Object xdialog_show (); |
| 128 | #endif | 130 | #endif |
| 129 | 131 | ||
| 132 | /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU | ||
| 133 | isn't defined. The use of HAVE_MULTILINGUAL_MENU could probably be | ||
| 134 | confined to an extended version of this with sections of code below | ||
| 135 | using it unconditionally. */ | ||
| 136 | #ifdef USE_GTK | ||
| 137 | /* gtk just uses utf-8. */ | ||
| 138 | # define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) | ||
| 139 | #else | ||
| 140 | /* I'm not convinced ENCODE_SYSTEM is defined correctly, or maybe | ||
| 141 | something else should be used here. Except under MS-Windows it | ||
| 142 | just converts to unibyte, but encoding with `locale-coding-system' | ||
| 143 | seems better -- X may actually display the result correctly, and | ||
| 144 | it's not necessarily equivalent to the unibyte text. -- fx */ | ||
| 145 | # define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str) | ||
| 146 | #endif | ||
| 147 | |||
| 130 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 148 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| 131 | Lisp_Object, Lisp_Object, Lisp_Object, | 149 | Lisp_Object, Lisp_Object, Lisp_Object, |
| 132 | Lisp_Object, Lisp_Object)); | 150 | Lisp_Object, Lisp_Object)); |
| @@ -633,7 +651,7 @@ list_of_panes (menu) | |||
| 633 | elt = Fcar (tail); | 651 | elt = Fcar (tail); |
| 634 | pane_name = Fcar (elt); | 652 | pane_name = Fcar (elt); |
| 635 | CHECK_STRING (pane_name); | 653 | CHECK_STRING (pane_name); |
| 636 | push_menu_pane (pane_name, Qnil); | 654 | push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil); |
| 637 | pane_data = Fcdr (elt); | 655 | pane_data = Fcdr (elt); |
| 638 | CHECK_CONS (pane_data); | 656 | CHECK_CONS (pane_data); |
| 639 | list_of_items (pane_data); | 657 | list_of_items (pane_data); |
| @@ -654,7 +672,8 @@ list_of_items (pane) | |||
| 654 | { | 672 | { |
| 655 | item = Fcar (tail); | 673 | item = Fcar (tail); |
| 656 | if (STRINGP (item)) | 674 | if (STRINGP (item)) |
| 657 | push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil); | 675 | push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt, |
| 676 | Qnil, Qnil, Qnil, Qnil); | ||
| 658 | else if (NILP (item)) | 677 | else if (NILP (item)) |
| 659 | push_left_right_boundary (); | 678 | push_left_right_boundary (); |
| 660 | else | 679 | else |
| @@ -662,7 +681,8 @@ list_of_items (pane) | |||
| 662 | CHECK_CONS (item); | 681 | CHECK_CONS (item); |
| 663 | item1 = Fcar (item); | 682 | item1 = Fcar (item); |
| 664 | CHECK_STRING (item1); | 683 | CHECK_STRING (item1); |
| 665 | push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil, Qnil); | 684 | push_menu_item (ENCODE_MENU_STRING (item1), Qt, Fcdr (item), |
| 685 | Qt, Qnil, Qnil, Qnil, Qnil); | ||
| 666 | } | 686 | } |
| 667 | } | 687 | } |
| 668 | } | 688 | } |
| @@ -1697,13 +1717,13 @@ digest_single_submenu (start, end, top_level_items) | |||
| 1697 | #ifndef HAVE_MULTILINGUAL_MENU | 1717 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1698 | if (STRING_MULTIBYTE (item_name)) | 1718 | if (STRING_MULTIBYTE (item_name)) |
| 1699 | { | 1719 | { |
| 1700 | item_name = ENCODE_SYSTEM (item_name); | 1720 | item_name = ENCODE_MENU_STRING (item_name); |
| 1701 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | 1721 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
| 1702 | } | 1722 | } |
| 1703 | 1723 | ||
| 1704 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 1724 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 1705 | { | 1725 | { |
| 1706 | descrip = ENCODE_SYSTEM (descrip); | 1726 | descrip = ENCODE_MENU_STRING (descrip); |
| 1707 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | 1727 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
| 1708 | } | 1728 | } |
| 1709 | #endif /* not HAVE_MULTILINGUAL_MENU */ | 1729 | #endif /* not HAVE_MULTILINGUAL_MENU */ |
| @@ -2377,7 +2397,6 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2377 | XButtonPressedEvent dummy; | 2397 | XButtonPressedEvent dummy; |
| 2378 | LWLIB_ID menu_id; | 2398 | LWLIB_ID menu_id; |
| 2379 | Widget menu; | 2399 | Widget menu; |
| 2380 | Window child; | ||
| 2381 | 2400 | ||
| 2382 | menu_id = widget_id_tick++; | 2401 | menu_id = widget_id_tick++; |
| 2383 | menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, | 2402 | menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, |
| @@ -2561,13 +2580,13 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2561 | #ifndef HAVE_MULTILINGUAL_MENU | 2580 | #ifndef HAVE_MULTILINGUAL_MENU |
| 2562 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) | 2581 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
| 2563 | { | 2582 | { |
| 2564 | item_name = ENCODE_SYSTEM (item_name); | 2583 | item_name = ENCODE_MENU_STRING (item_name); |
| 2565 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | 2584 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
| 2566 | } | 2585 | } |
| 2567 | 2586 | ||
| 2568 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 2587 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 2569 | { | 2588 | { |
| 2570 | descrip = ENCODE_SYSTEM (descrip); | 2589 | descrip = ENCODE_MENU_STRING (descrip); |
| 2571 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | 2590 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
| 2572 | } | 2591 | } |
| 2573 | #endif /* not HAVE_MULTILINGUAL_MENU */ | 2592 | #endif /* not HAVE_MULTILINGUAL_MENU */ |
| @@ -2627,7 +2646,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2627 | 2646 | ||
| 2628 | #ifndef HAVE_MULTILINGUAL_MENU | 2647 | #ifndef HAVE_MULTILINGUAL_MENU |
| 2629 | if (STRING_MULTIBYTE (title)) | 2648 | if (STRING_MULTIBYTE (title)) |
| 2630 | title = ENCODE_SYSTEM (title); | 2649 | title = ENCODE_MENU_STRING (title); |
| 2631 | #endif | 2650 | #endif |
| 2632 | 2651 | ||
| 2633 | wv_title->name = (char *) SDATA (title); | 2652 | wv_title->name = (char *) SDATA (title); |