summaryrefslogtreecommitdiff
path: root/src/macmenu.c
diff options
context:
space:
mode:
authorSteven Tamm <steventamm@mac.com>2004-08-26 18:43:29 +0000
committerSteven Tamm <steventamm@mac.com>2004-08-26 18:43:29 +0000
commit383418e5122ee80b530e7df96c27be7cffd8a5f1 (patch)
treedb9f90cf2da2366a5fc95665b4560ebb75e17c29 /src/macmenu.c
parent6eb3ee72e0d9a53835288bbd6b53dafddea714d6 (diff)
downloademacs-383418e5122ee80b530e7df96c27be7cffd8a5f1.tar.gz
macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
strings in menu items. (single_submenu): Use ENCODE_MENU_STRING (mac_menu_show): Use ENCODE_MENU_STRING. Reset grabbed because button release isn't passed to event loop (add_menu_item): Use SetMenuItemWithCFString
Diffstat (limited to 'src/macmenu.c')
-rw-r--r--src/macmenu.c30
1 files changed, 25 insertions, 5 deletions
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;
extern Lisp_Object Qmenu_bar_update_hook;
+#if TARGET_API_MAC_CARBON
+#define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
+#else
+#define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str)
+#endif
+
void set_frame_menubar ();
static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
@@ -1246,13 +1252,13 @@ single_submenu (item_key, item_name, maps)
#ifndef HAVE_MULTILINGUAL_MENU
if (STRING_MULTIBYTE (item_name))
{
- item_name = ENCODE_SYSTEM (item_name);
+ item_name = ENCODE_MENU_STRING (item_name);
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
}
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
{
- descrip = ENCODE_SYSTEM (descrip);
+ descrip = ENCODE_MENU_STRING (descrip);
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
}
#endif /* not HAVE_MULTILINGUAL_MENU */
@@ -1705,12 +1711,12 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
#ifndef HAVE_MULTILINGUAL_MENU
if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
{
- item_name = ENCODE_SYSTEM (item_name);
+ item_name = ENCODE_MENU_STRING (item_name);
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
}
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
{
- descrip = ENCODE_SYSTEM (descrip);
+ descrip = ENCODE_MENU_STRING (descrip);
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
}
#endif /* not HAVE_MULTILINGUAL_MENU */
@@ -1764,7 +1770,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
#ifndef HAVE_MULTILINGUAL_MENU
if (STRING_MULTIBYTE (title))
- title = ENCODE_SYSTEM (title);
+ title = ENCODE_MENU_STRING (title);
#endif
wv_title->name = (char *) SDATA (title);
wv_title->enabled = TRUE;
@@ -1813,6 +1819,10 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
discard_mouse_events ();
#endif
+ /* Must reset this manually because the button release event is not
+ passed to Emacs event loop. */
+ FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
+
/* Free the widget_value objects we used to specify the
contents. */
free_menubar_widget_value_tree (first_wv);
@@ -2219,8 +2229,18 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu,
strncat (item_name, wv->key, 255);
}
item_name[255] = 0;
+#if TARGET_API_MAC_CARBON
+ {
+ CFStringRef string =
+ CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8);
+
+ SetMenuItemTextWithCFString (menu, pos, string);
+ CFRelease (string);
+ }
+#else
c2pstr (item_name);
SetMenuItemText (menu, pos, item_name);
+#endif
if (wv->enabled && !force_disable)
#if TARGET_API_MAC_CARBON