comparison src/macterm.c @ 48926:fc0983df599f

* macterm.c (XTread_socket): Call KeyTranslate for control and meta to deal correctly shifted non-alpha characters, like C-S-5 being treated like C-%. Does not look for shift key to deal with masking off control-key with mac-reverse-ctrl-meta.
author Steven Tamm <steventamm@mac.com>
date Sun, 22 Dec 2002 21:09:20 +0000
parents 5030a4c296d2
children 532fc9301fcd
comparison
equal deleted inserted replaced
48925:cd1c70649388 48926:fc0983df599f
12929 else if (keycode_to_xkeysym (keycode, &xkeysym)) 12929 else if (keycode_to_xkeysym (keycode, &xkeysym))
12930 { 12930 {
12931 bufp->code = 0xff00 | xkeysym; 12931 bufp->code = 0xff00 | xkeysym;
12932 bufp->kind = NON_ASCII_KEYSTROKE_EVENT; 12932 bufp->kind = NON_ASCII_KEYSTROKE_EVENT;
12933 } 12933 }
12934 else if (!NILP (Vmac_reverse_ctrl_meta) && (er.modifiers & controlKey))
12935 {
12936 /* This is a special case to deal with converting from
12937 a control character to non-control character */
12938 int new_modifiers = er.modifiers & ~controlKey;
12939 int new_keycode = keycode | new_modifiers;
12940 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
12941 unsigned long some_state = 0;
12942 bufp->code = KeyTranslate (kchr_ptr, new_keycode, &some_state) & 0xff;
12943 bufp->kind = ASCII_KEYSTROKE_EVENT;
12944 }
12945 else 12934 else
12946 { 12935 {
12947 if (er.modifiers & macMetaKey) 12936 if (er.modifiers & (controlKey |
12937 (NILP (Vmac_command_key_is_meta) ? optionKey
12938 : cmdKey)))
12948 { 12939 {
12949 /* This code comes from Keyboard Resource, Appendix 12940 /* This code comes from Keyboard Resource, Appendix
12950 C of IM - Text. This is necessary since shift is 12941 C of IM - Text. This is necessary since shift is
12951 ignored in KCHR table translation when option or 12942 ignored in KCHR table translation when option or
12952 command is pressed. */ 12943 command is pressed. It also does not translate
12953 int new_modifiers = er.modifiers & 0xf600; 12944 correctly control-shift chars like C-% so mask off
12945 shift here also */
12946 int new_modifiers = er.modifiers & 0xe600;
12954 /* mask off option and command */ 12947 /* mask off option and command */
12955 int new_keycode = keycode | new_modifiers; 12948 int new_keycode = keycode | new_modifiers;
12956 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); 12949 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
12957 unsigned long some_state = 0; 12950 unsigned long some_state = 0;
12958 bufp->code = KeyTranslate (kchr_ptr, new_keycode, 12951 bufp->code = KeyTranslate (kchr_ptr, new_keycode,