# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1113470701 0 # Node ID 72c95a1c84c62a59ea0d635b0c0f80a0d93f3858 # Parent 31beabfbf4248dcf7c1d5fea96edee692244a276 [!TARGET_API_MAC_CARBON]: Include MacLocales.h. Don't include TextEncodingConverter.h. (mac_system_script_code, Vmac_system_locale): New variables. (syms_of_mac): Defvar them. (mac_get_system_locale): New function. diff -r 31beabfbf424 -r 72c95a1c84c6 src/ChangeLog --- a/src/ChangeLog Thu Apr 14 09:22:38 2005 +0000 +++ b/src/ChangeLog Thu Apr 14 09:25:01 2005 +0000 @@ -1,3 +1,20 @@ +2005-04-14 YAMAMOTO Mitsuharu + + * mac.c [!TARGET_API_MAC_CARBON]: Include MacLocales.h. Don't + include TextEncodingConverter.h. + (mac_system_script_code, Vmac_system_locale): New variables. + (syms_of_mac): Defvar them. + (mac_get_system_locale): New function. + + * macfns.c (x_set_name, x_set_title) [!TARGET_API_MAC_CARBON]: Use + ENCODE_SYSTEM to encode title bar string. + (x_create_tip_frame): Apply 2005-03-18 change for xfns.c. + (Fx_file_dialog) [TARGET_API_MAC_CARBON && !MAC_OSX]: Use + CFStringGetSystemEncoding to get system default string encoding. + + * macterm.c [!TARGET_API_MAC_CARBON]: Don't include + TextEncodingConverter.h. + 2005-04-13 Steven Tamm * macterm.c (syms_of_macterm): Remove redundant definition of diff -r 31beabfbf424 -r 72c95a1c84c6 src/mac.c --- a/src/mac.c Thu Apr 14 09:22:38 2005 +0000 +++ b/src/mac.c Thu Apr 14 09:25:01 2005 +0000 @@ -49,6 +49,7 @@ #include #include #include +#include #endif /* not HAVE_CARBON */ #include @@ -67,6 +68,12 @@ Lisp_Object QCLIPBOARD; +/* The system script code. */ +static int mac_system_script_code; + +/* The system locale identifier string. */ +static Lisp_Object Vmac_system_locale; + /* An instance of the AppleScript component. */ static ComponentInstance as_scripting_component; /* The single script context used for all script executions. */ @@ -4167,6 +4174,29 @@ } #endif /* MAC_OSX */ + +static Lisp_Object +mac_get_system_locale () +{ + OSErr err; + LangCode lang; + RegionCode region; + LocaleRef locale; + Str255 str; + + lang = GetScriptVariable (smSystemScript, smScriptLang); + region = GetScriptManagerVariable (smRegionCode); + err = LocaleRefFromLangOrRegionCode (lang, region, &locale); + if (err == noErr) + err = LocaleRefGetPartString (locale, kLocaleAllPartsMask, + sizeof (str), str); + if (err == noErr) + return build_string (str); + else + return Qnil; +} + + void syms_of_mac () { @@ -4197,6 +4227,16 @@ defsubr (&Sdo_applescript); defsubr (&Smac_file_name_to_posix); defsubr (&Sposix_file_name_to_mac); + + DEFVAR_INT ("mac-system-script-code", &mac_system_script_code, + doc: /* The system script code. */); + mac_system_script_code = (ScriptCode) GetScriptManagerVariable (smSysScript); + + DEFVAR_LISP ("mac-system-locale", &Vmac_system_locale, + doc: /* The system locale identifier string. +This is not a POSIX locale ID, but an ICU locale ID. So encoding +information is not included. */); + Vmac_system_locale = mac_get_system_locale (); } /* arch-tag: 29d30c1f-0c6b-4f88-8a6d-0558d7f9dbff