aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2006-05-24 08:08:43 +0000
committerYAMAMOTO Mitsuharu2006-05-24 08:08:43 +0000
commita16ac62430e928e2fa99855a04cb9b14ddb60233 (patch)
tree3d75792b424148207ca0d5cb076e073ea50bc4b7
parent0ffd2c761b8f19e8dacaa5d86543afa43b02c427 (diff)
downloademacs-a16ac62430e928e2fa99855a04cb9b14ddb60233.tar.gz
emacs-a16ac62430e928e2fa99855a04cb9b14ddb60233.zip
(fn_keycode_to_keycode_table, XTread_socket) [MAC_OSX]:
Fix last change. Don't map `fn' modifier if pressed with F1 ... F12.
-rw-r--r--src/macterm.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 8ed33226036..1f25b022f38 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -9632,8 +9632,9 @@ keycode_to_xkeysym (int keyCode, int *xKeySym)
9632#ifdef MAC_OSX 9632#ifdef MAC_OSX
9633/* Table for translating Mac keycode with the laptop `fn' key to that 9633/* Table for translating Mac keycode with the laptop `fn' key to that
9634 without it. Destination symbols in comments are keys on US 9634 without it. Destination symbols in comments are keys on US
9635 keyboard, and they may not be the same on other types of 9635 keyboard, and they may not be the same on other types of keyboards.
9636 keyboards. */ 9636 If the destination is identical to the source (f1 ... f12), it
9637 doesn't map `fn' key to a modifier. */
9637static unsigned char fn_keycode_to_keycode_table[] = { 9638static unsigned char fn_keycode_to_keycode_table[] = {
9638 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9639 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9639 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9640 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -9654,14 +9655,14 @@ static unsigned char fn_keycode_to_keycode_table[] = {
9654 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/, 9655 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
9655 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0, 9656 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
9656 9657
9657 /*0x60*/ 0, 0, 0, 0, 9658 /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/,
9658 /*0x64*/ 0, 0, 0, 0, 9659 /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/,
9659 /*0x68*/ 0, 0, 0, 0, 9660 /*0x68*/ 0, 0, 0, 0,
9660 /*0x6C*/ 0, 0, 0, 0, 9661 /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/,
9661 9662
9662 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/, 9663 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/,
9663 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0, 0x7c /*end -> right*/, 9664 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/,
9664 /*0x78*/ 0, 0x7d /*pgdown -> down*/, 0, 0, 9665 /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0,
9665 /*0x7C*/ 0, 0, 0, 0 9666 /*0x7C*/ 0, 0, 0, 0
9666}; 9667};
9667#endif /* MAC_OSX */ 9668#endif /* MAC_OSX */
@@ -10311,14 +10312,16 @@ XTread_socket (sd, expected, hold_quit)
10311 GetEventParameter (eventRef, kEventParamKeyModifiers, 10312 GetEventParameter (eventRef, kEventParamKeyModifiers,
10312 typeUInt32, NULL, 10313 typeUInt32, NULL,
10313 sizeof (UInt32), NULL, &modifiers); 10314 sizeof (UInt32), NULL, &modifiers);
10315#endif
10316 mapped_modifiers &= modifiers;
10314 10317
10318#if USE_CARBON_EVENTS && defined (MAC_OSX)
10315 /* When using Carbon Events, we need to pass raw keyboard 10319 /* When using Carbon Events, we need to pass raw keyboard
10316 events to the TSM ourselves. If TSM handles it, it 10320 events to the TSM ourselves. If TSM handles it, it
10317 will pass back noErr, otherwise it will pass back 10321 will pass back noErr, otherwise it will pass back
10318 "eventNotHandledErr" and we can process it 10322 "eventNotHandledErr" and we can process it
10319 normally. */ 10323 normally. */
10320 if (!(modifiers 10324 if (!(mapped_modifiers
10321 & mapped_modifiers
10322 & ~(mac_pass_command_to_system ? cmdKey : 0) 10325 & ~(mac_pass_command_to_system ? cmdKey : 0)
10323 & ~(mac_pass_control_to_system ? controlKey : 0))) 10326 & ~(mac_pass_control_to_system ? controlKey : 0)))
10324 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) 10327 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
@@ -10355,7 +10358,7 @@ XTread_socket (sd, expected, hold_quit)
10355 } 10358 }
10356 10359
10357#ifdef MAC_OSX 10360#ifdef MAC_OSX
10358 if (modifiers & kEventKeyModifierFnMask 10361 if (mapped_modifiers & kEventKeyModifierFnMask
10359 && keycode <= 0x7f 10362 && keycode <= 0x7f
10360 && fn_keycode_to_keycode_table[keycode]) 10363 && fn_keycode_to_keycode_table[keycode])
10361 keycode = fn_keycode_to_keycode_table[keycode]; 10364 keycode = fn_keycode_to_keycode_table[keycode];
@@ -10364,8 +10367,14 @@ XTread_socket (sd, expected, hold_quit)
10364 { 10367 {
10365 inev.kind = NON_ASCII_KEYSTROKE_EVENT; 10368 inev.kind = NON_ASCII_KEYSTROKE_EVENT;
10366 inev.code = 0xff00 | xkeysym; 10369 inev.code = 0xff00 | xkeysym;
10370#ifdef MAC_OSX
10371 if (modifiers & kEventKeyModifierFnMask
10372 && keycode <= 0x7f
10373 && fn_keycode_to_keycode_table[keycode] == keycode)
10374 modifiers &= ~kEventKeyModifierFnMask;
10375#endif
10367 } 10376 }
10368 else if (modifiers & mapped_modifiers) 10377 else if (mapped_modifiers)
10369 { 10378 {
10370 /* translate the keycode back to determine the 10379 /* translate the keycode back to determine the
10371 original key */ 10380 original key */
@@ -10444,11 +10453,7 @@ XTread_socket (sd, expected, hold_quit)
10444 inev.code = er.message & charCodeMask; 10453 inev.code = er.message & charCodeMask;
10445 } 10454 }
10446 10455
10447#if USE_CARBON_EVENTS 10456 inev.modifiers = mac_to_emacs_modifiers (modifiers);
10448 inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
10449#else
10450 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
10451#endif
10452 inev.modifiers |= (extra_keyboard_modifiers 10457 inev.modifiers |= (extra_keyboard_modifiers
10453 & (meta_modifier | alt_modifier 10458 & (meta_modifier | alt_modifier
10454 | hyper_modifier | super_modifier)); 10459 | hyper_modifier | super_modifier));