diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/macmenu.c | 30 |
2 files changed, 34 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fa1922c6255..aa3721d9106 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2004-08-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte | ||
| 4 | strings in menu items. | ||
| 5 | (single_submenu): Use ENCODE_MENU_STRING | ||
| 6 | (mac_menu_show): Use ENCODE_MENU_STRING. Reset grabbed because | ||
| 7 | button release isn't passed to event loop | ||
| 8 | (add_menu_item): Use SetMenuItemWithCFString | ||
| 9 | |||
| 1 | 2004-08-26 Steven Tamm <steventamm@mac.com> | 10 | 2004-08-26 Steven Tamm <steventamm@mac.com> |
| 2 | 11 | ||
| 3 | * fileio.c (Fread_file_name): Call x_file_dialog on carbon on | 12 | * fileio.c (Fread_file_name): Call x_file_dialog on carbon on |
diff --git a/src/macmenu.c b/src/macmenu.c index d205ee3b877..67e18481a1b 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -163,6 +163,12 @@ extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; | |||
| 163 | 163 | ||
| 164 | extern Lisp_Object Qmenu_bar_update_hook; | 164 | extern Lisp_Object Qmenu_bar_update_hook; |
| 165 | 165 | ||
| 166 | #if TARGET_API_MAC_CARBON | ||
| 167 | #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) | ||
| 168 | #else | ||
| 169 | #define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str) | ||
| 170 | #endif | ||
| 171 | |||
| 166 | void set_frame_menubar (); | 172 | void set_frame_menubar (); |
| 167 | 173 | ||
| 168 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 174 | static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| @@ -1246,13 +1252,13 @@ single_submenu (item_key, item_name, maps) | |||
| 1246 | #ifndef HAVE_MULTILINGUAL_MENU | 1252 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1247 | if (STRING_MULTIBYTE (item_name)) | 1253 | if (STRING_MULTIBYTE (item_name)) |
| 1248 | { | 1254 | { |
| 1249 | item_name = ENCODE_SYSTEM (item_name); | 1255 | item_name = ENCODE_MENU_STRING (item_name); |
| 1250 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | 1256 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
| 1251 | } | 1257 | } |
| 1252 | 1258 | ||
| 1253 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 1259 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 1254 | { | 1260 | { |
| 1255 | descrip = ENCODE_SYSTEM (descrip); | 1261 | descrip = ENCODE_MENU_STRING (descrip); |
| 1256 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | 1262 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
| 1257 | } | 1263 | } |
| 1258 | #endif /* not HAVE_MULTILINGUAL_MENU */ | 1264 | #endif /* not HAVE_MULTILINGUAL_MENU */ |
| @@ -1705,12 +1711,12 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1705 | #ifndef HAVE_MULTILINGUAL_MENU | 1711 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1706 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) | 1712 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
| 1707 | { | 1713 | { |
| 1708 | item_name = ENCODE_SYSTEM (item_name); | 1714 | item_name = ENCODE_MENU_STRING (item_name); |
| 1709 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | 1715 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
| 1710 | } | 1716 | } |
| 1711 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 1717 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 1712 | { | 1718 | { |
| 1713 | descrip = ENCODE_SYSTEM (descrip); | 1719 | descrip = ENCODE_MENU_STRING (descrip); |
| 1714 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | 1720 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
| 1715 | } | 1721 | } |
| 1716 | #endif /* not HAVE_MULTILINGUAL_MENU */ | 1722 | #endif /* not HAVE_MULTILINGUAL_MENU */ |
| @@ -1764,7 +1770,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1764 | 1770 | ||
| 1765 | #ifndef HAVE_MULTILINGUAL_MENU | 1771 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1766 | if (STRING_MULTIBYTE (title)) | 1772 | if (STRING_MULTIBYTE (title)) |
| 1767 | title = ENCODE_SYSTEM (title); | 1773 | title = ENCODE_MENU_STRING (title); |
| 1768 | #endif | 1774 | #endif |
| 1769 | wv_title->name = (char *) SDATA (title); | 1775 | wv_title->name = (char *) SDATA (title); |
| 1770 | wv_title->enabled = TRUE; | 1776 | wv_title->enabled = TRUE; |
| @@ -1813,6 +1819,10 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1813 | discard_mouse_events (); | 1819 | discard_mouse_events (); |
| 1814 | #endif | 1820 | #endif |
| 1815 | 1821 | ||
| 1822 | /* Must reset this manually because the button release event is not | ||
| 1823 | passed to Emacs event loop. */ | ||
| 1824 | FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; | ||
| 1825 | |||
| 1816 | /* Free the widget_value objects we used to specify the | 1826 | /* Free the widget_value objects we used to specify the |
| 1817 | contents. */ | 1827 | contents. */ |
| 1818 | free_menubar_widget_value_tree (first_wv); | 1828 | free_menubar_widget_value_tree (first_wv); |
| @@ -2219,8 +2229,18 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | |||
| 2219 | strncat (item_name, wv->key, 255); | 2229 | strncat (item_name, wv->key, 255); |
| 2220 | } | 2230 | } |
| 2221 | item_name[255] = 0; | 2231 | item_name[255] = 0; |
| 2232 | #if TARGET_API_MAC_CARBON | ||
| 2233 | { | ||
| 2234 | CFStringRef string = | ||
| 2235 | CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8); | ||
| 2236 | |||
| 2237 | SetMenuItemTextWithCFString (menu, pos, string); | ||
| 2238 | CFRelease (string); | ||
| 2239 | } | ||
| 2240 | #else | ||
| 2222 | c2pstr (item_name); | 2241 | c2pstr (item_name); |
| 2223 | SetMenuItemText (menu, pos, item_name); | 2242 | SetMenuItemText (menu, pos, item_name); |
| 2243 | #endif | ||
| 2224 | 2244 | ||
| 2225 | if (wv->enabled && !force_disable) | 2245 | if (wv->enabled && !force_disable) |
| 2226 | #if TARGET_API_MAC_CARBON | 2246 | #if TARGET_API_MAC_CARBON |