7146 |
Lisp_Object Vmac_pass_control_to_system; |
Lisp_Object Vmac_pass_control_to_system; |
7147 |
#endif |
#endif |
7148 |
|
|
|
/* convert input from Mac keyboard (assumed to be in Mac Roman coding) |
|
|
to this text encoding */ |
|
|
int mac_keyboard_text_encoding; |
|
|
int current_mac_keyboard_text_encoding = kTextEncodingMacRoman; |
|
|
|
|
7149 |
/* Set in term/mac-win.el to indicate that event loop can now generate |
/* Set in term/mac-win.el to indicate that event loop can now generate |
7150 |
drag and drop events. */ |
drag and drop events. */ |
7151 |
Lisp_Object Qmac_ready_for_drag_n_drop; |
Lisp_Object Qmac_ready_for_drag_n_drop; |
8959 |
break; |
break; |
8960 |
} |
} |
8961 |
#endif |
#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 |
|
} |
8979 |
|
|
8980 |
ObscureCursor (); |
ObscureCursor (); |
8981 |
|
|
9028 |
} |
} |
9029 |
} |
} |
9030 |
|
|
|
/* If variable mac-convert-keyboard-input-to-latin-1 is |
|
|
non-nil, convert non-ASCII characters typed at the Mac |
|
|
keyboard (presumed to be in the Mac Roman encoding) to |
|
|
iso-latin-1 encoding before they are passed to Emacs. |
|
|
This enables the Mac keyboard to be used to enter |
|
|
non-ASCII iso-latin-1 characters directly. */ |
|
|
if (mac_keyboard_text_encoding != kTextEncodingMacRoman |
|
|
&& inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128) |
|
|
{ |
|
|
static TECObjectRef converter = NULL; |
|
|
OSStatus the_err = noErr; |
|
|
OSStatus convert_status = noErr; |
|
|
|
|
|
if (converter == NULL) |
|
|
{ |
|
|
the_err = TECCreateConverter (&converter, |
|
|
kTextEncodingMacRoman, |
|
|
mac_keyboard_text_encoding); |
|
|
current_mac_keyboard_text_encoding |
|
|
= mac_keyboard_text_encoding; |
|
|
} |
|
|
else if (mac_keyboard_text_encoding |
|
|
!= current_mac_keyboard_text_encoding) |
|
|
{ |
|
|
/* Free the converter for the current encoding |
|
|
before creating a new one. */ |
|
|
TECDisposeConverter (converter); |
|
|
the_err = TECCreateConverter (&converter, |
|
|
kTextEncodingMacRoman, |
|
|
mac_keyboard_text_encoding); |
|
|
current_mac_keyboard_text_encoding |
|
|
= mac_keyboard_text_encoding; |
|
|
} |
|
|
|
|
|
if (the_err == noErr) |
|
|
{ |
|
|
unsigned char ch = inev.code; |
|
|
ByteCount actual_input_length, actual_output_length; |
|
|
unsigned char outbuf[32]; |
|
|
|
|
|
convert_status = TECConvertText (converter, &ch, 1, |
|
|
&actual_input_length, |
|
|
outbuf, 1, |
|
|
&actual_output_length); |
|
|
if (convert_status == noErr |
|
|
&& actual_input_length == 1 |
|
|
&& actual_output_length == 1) |
|
|
inev.code = *outbuf; |
|
|
|
|
|
/* Reset internal states of the converter object. |
|
|
If it fails, create another one. */ |
|
|
convert_status = TECFlushText (converter, outbuf, |
|
|
sizeof (outbuf), |
|
|
&actual_output_length); |
|
|
if (convert_status != noErr) |
|
|
{ |
|
|
TECDisposeConverter (converter); |
|
|
TECCreateConverter (&converter, |
|
|
kTextEncodingMacRoman, |
|
|
mac_keyboard_text_encoding); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
9031 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
9032 |
inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
9033 |
#else |
#else |
9840 |
The text will be rendered using Core Graphics text rendering which |
The text will be rendered using Core Graphics text rendering which |
9841 |
may anti-alias the text. */); |
may anti-alias the text. */); |
9842 |
Vmac_use_core_graphics = Qnil; |
Vmac_use_core_graphics = Qnil; |
|
|
|
|
DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, |
|
|
doc: /* One of the Text Encoding Base constant values defined in the |
|
|
Basic Text Constants section of Inside Macintosh - Text Encoding |
|
|
Conversion Manager. Its value determines the encoding characters |
|
|
typed at the Mac keyboard (presumed to be in the MacRoman encoding) |
|
|
will convert into. E.g., if it is set to kTextEncodingMacRoman (0), |
|
|
its default value, no conversion takes place. If it is set to |
|
|
kTextEncodingISOLatin1 (0x201) or kTextEncodingISOLatin2 (0x202), |
|
|
characters typed on Mac keyboard are first converted into the |
|
|
ISO Latin-1 or ISO Latin-2 encoding, respectively before being |
|
|
passed to Emacs. Together with Emacs's set-keyboard-coding-system |
|
|
command, this enables the Mac keyboard to be used to enter non-ASCII |
|
|
characters directly. */); |
|
|
mac_keyboard_text_encoding = kTextEncodingMacRoman; |
|
9843 |
} |
} |
9844 |
|
|
9845 |
/* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |
/* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |