aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2005-04-12 10:26:08 +0000
committerYAMAMOTO Mitsuharu2005-04-12 10:26:08 +0000
commit778f4455230cec7470ee31020a177cedd8ca81b8 (patch)
tree552097b0a5156ccf3899495989b9f5ecb05a25f4 /src
parentc16dab62b207b82ac3b09239b5f9b0d351b78035 (diff)
downloademacs-778f4455230cec7470ee31020a177cedd8ca81b8.tar.gz
emacs-778f4455230cec7470ee31020a177cedd8ca81b8.zip
(mac_keyboard_text_encoding, current_mac_keyboard_text_encoding):
Remove variables. (XTread_socket): Store language-change event if keyboard script change is detected. Don't convert input to `mac_keyboard_text_encoding'. (syms_of_macterm): Delete DEFVAR_INT for mac-keyboard-text-encoding.
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c101
1 files changed, 17 insertions, 84 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 67a3f1e0107..c77bcba6d0c 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -7146,11 +7146,6 @@ Lisp_Object Vmac_pass_command_to_system;
7146Lisp_Object Vmac_pass_control_to_system; 7146Lisp_Object Vmac_pass_control_to_system;
7147#endif 7147#endif
7148 7148
7149/* convert input from Mac keyboard (assumed to be in Mac Roman coding)
7150 to this text encoding */
7151int mac_keyboard_text_encoding;
7152int current_mac_keyboard_text_encoding = kTextEncodingMacRoman;
7153
7154/* Set in term/mac-win.el to indicate that event loop can now generate 7149/* Set in term/mac-win.el to indicate that event loop can now generate
7155 drag and drop events. */ 7150 drag and drop events. */
7156Lisp_Object Qmac_ready_for_drag_n_drop; 7151Lisp_Object Qmac_ready_for_drag_n_drop;
@@ -8964,6 +8959,23 @@ XTread_socket (sd, expected, hold_quit)
8964 break; 8959 break;
8965 } 8960 }
8966#endif 8961#endif
8962 {
8963 static SInt16 last_key_script = -1;
8964 SInt16 current_key_script = GetScriptManagerVariable (smKeyScript);
8965
8966 if (last_key_script != current_key_script)
8967 {
8968 struct input_event event;
8969
8970 EVENT_INIT (event);
8971 event.kind = LANGUAGE_CHANGE_EVENT;
8972 event.arg = Qnil;
8973 event.code = current_key_script;
8974 kbd_buffer_store_event (&event);
8975 count++;
8976 }
8977 last_key_script = current_key_script;
8978 }
8967 8979
8968 ObscureCursor (); 8980 ObscureCursor ();
8969 8981
@@ -9016,70 +9028,6 @@ XTread_socket (sd, expected, hold_quit)
9016 } 9028 }
9017 } 9029 }
9018 9030
9019 /* If variable mac-convert-keyboard-input-to-latin-1 is
9020 non-nil, convert non-ASCII characters typed at the Mac
9021 keyboard (presumed to be in the Mac Roman encoding) to
9022 iso-latin-1 encoding before they are passed to Emacs.
9023 This enables the Mac keyboard to be used to enter
9024 non-ASCII iso-latin-1 characters directly. */
9025 if (mac_keyboard_text_encoding != kTextEncodingMacRoman
9026 && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128)
9027 {
9028 static TECObjectRef converter = NULL;
9029 OSStatus the_err = noErr;
9030 OSStatus convert_status = noErr;
9031
9032 if (converter == NULL)
9033 {
9034 the_err = TECCreateConverter (&converter,
9035 kTextEncodingMacRoman,
9036 mac_keyboard_text_encoding);
9037 current_mac_keyboard_text_encoding
9038 = mac_keyboard_text_encoding;
9039 }
9040 else if (mac_keyboard_text_encoding
9041 != current_mac_keyboard_text_encoding)
9042 {
9043 /* Free the converter for the current encoding
9044 before creating a new one. */
9045 TECDisposeConverter (converter);
9046 the_err = TECCreateConverter (&converter,
9047 kTextEncodingMacRoman,
9048 mac_keyboard_text_encoding);
9049 current_mac_keyboard_text_encoding
9050 = mac_keyboard_text_encoding;
9051 }
9052
9053 if (the_err == noErr)
9054 {
9055 unsigned char ch = inev.code;
9056 ByteCount actual_input_length, actual_output_length;
9057 unsigned char outbuf[32];
9058
9059 convert_status = TECConvertText (converter, &ch, 1,
9060 &actual_input_length,
9061 outbuf, 1,
9062 &actual_output_length);
9063 if (convert_status == noErr
9064 && actual_input_length == 1
9065 && actual_output_length == 1)
9066 inev.code = *outbuf;
9067
9068 /* Reset internal states of the converter object.
9069 If it fails, create another one. */
9070 convert_status = TECFlushText (converter, outbuf,
9071 sizeof (outbuf),
9072 &actual_output_length);
9073 if (convert_status != noErr)
9074 {
9075 TECDisposeConverter (converter);
9076 TECCreateConverter (&converter,
9077 kTextEncodingMacRoman,
9078 mac_keyboard_text_encoding);
9079 }
9080 }
9081 }
9082
9083#if USE_CARBON_EVENTS 9031#if USE_CARBON_EVENTS
9084 inev.modifiers = mac_event_to_emacs_modifiers (eventRef); 9032 inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
9085#else 9033#else
@@ -9892,21 +9840,6 @@ Toolbox for processing before Emacs sees it. */);
9892The text will be rendered using Core Graphics text rendering which 9840The text will be rendered using Core Graphics text rendering which
9893may anti-alias the text. */); 9841may anti-alias the text. */);
9894 Vmac_use_core_graphics = Qnil; 9842 Vmac_use_core_graphics = Qnil;
9895
9896 DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding,
9897 doc: /* One of the Text Encoding Base constant values defined in the
9898Basic Text Constants section of Inside Macintosh - Text Encoding
9899Conversion Manager. Its value determines the encoding characters
9900typed at the Mac keyboard (presumed to be in the MacRoman encoding)
9901will convert into. E.g., if it is set to kTextEncodingMacRoman (0),
9902its default value, no conversion takes place. If it is set to
9903kTextEncodingISOLatin1 (0x201) or kTextEncodingISOLatin2 (0x202),
9904characters typed on Mac keyboard are first converted into the
9905ISO Latin-1 or ISO Latin-2 encoding, respectively before being
9906passed to Emacs. Together with Emacs's set-keyboard-coding-system
9907command, this enables the Mac keyboard to be used to enter non-ASCII
9908characters directly. */);
9909 mac_keyboard_text_encoding = kTextEncodingMacRoman;
9910} 9843}
9911 9844
9912/* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b 9845/* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b