diff options
| author | Jan Djärv | 2010-11-21 14:09:34 +0100 |
|---|---|---|
| committer | Jan Djärv | 2010-11-21 14:09:34 +0100 |
| commit | b7d1e1444724b4f2e47df2cac9983c4f9ac0a21a (patch) | |
| tree | 365d8fcd2196648bf584a54b117b4f9601e874da /src | |
| parent | 034244e55ba9223e7929fada1c2a545c4beee95c (diff) | |
| download | emacs-b7d1e1444724b4f2e47df2cac9983c4f9ac0a21a.tar.gz emacs-b7d1e1444724b4f2e47df2cac9983c4f9ac0a21a.zip | |
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
* lisp/cus-start.el (all): Add ns-right-control-modifier and
ns-right-command-modifier.
* lisp/term/ns-win.el (ns-right-control-modifier)
(ns-right-command-modifier): Defvar them.
* src/nsterm.m (ns_right_command_modifier, ns_right_control_modifier):
Define (Bug#7458).
(NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458).
(EV_MODIFIERS): Check for NSRightCommandKeyMask and
NSRightControlKeyMask also (Bug#7458).
(keyDown): Ditto (Bug#7458).
(syms_of_nsterm): Defvar ns-right-command-modifier and
ns-right-control-modifier (Bug#7458).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/nsterm.m | 56 |
2 files changed, 64 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f5ab88743b1..8a77fc15792 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-11-21 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (ns_right_command_modifier, ns_right_control_modifier): | ||
| 4 | Define (Bug#7458). | ||
| 5 | (NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458). | ||
| 6 | (EV_MODIFIERS): Check for NSRightCommandKeyMask and | ||
| 7 | NSRightControlKeyMask also (Bug#7458). | ||
| 8 | (keyDown): Ditto (Bug#7458). | ||
| 9 | (syms_of_nsterm): Defvar ns-right-command-modifier and | ||
| 10 | ns-right-control-modifier (Bug#7458). | ||
| 11 | |||
| 1 | 2010-11-21 Dan Nicolaescu <dann@ics.uci.edu> | 12 | 2010-11-21 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 13 | ||
| 3 | * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. | 14 | * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. |
diff --git a/src/nsterm.m b/src/nsterm.m index 10607766086..06d7354873d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -158,10 +158,20 @@ Lisp_Object ns_right_alternate_modifier; | |||
| 158 | Lisp_Object ns_command_modifier; | 158 | Lisp_Object ns_command_modifier; |
| 159 | 159 | ||
| 160 | /* Specifies which emacs modifier should be generated when NS receives | 160 | /* Specifies which emacs modifier should be generated when NS receives |
| 161 | the right Command modifier. Has same values as ns_command_modifier plus | ||
| 162 | the value Qleft which means whatever value ns_command_modifier has. */ | ||
| 163 | Lisp_Object ns_right_command_modifier; | ||
| 164 | |||
| 165 | /* Specifies which emacs modifier should be generated when NS receives | ||
| 161 | the Control modifier. May be any of the modifier lisp symbols. */ | 166 | the Control modifier. May be any of the modifier lisp symbols. */ |
| 162 | Lisp_Object ns_control_modifier; | 167 | Lisp_Object ns_control_modifier; |
| 163 | 168 | ||
| 164 | /* Specifies which emacs modifier should be generated when NS receives | 169 | /* Specifies which emacs modifier should be generated when NS receives |
| 170 | the right Control modifier. Has same values as ns_control_modifier plus | ||
| 171 | the value Qleft which means whatever value ns_control_modifier has. */ | ||
| 172 | Lisp_Object ns_right_control_modifier; | ||
| 173 | |||
| 174 | /* Specifies which emacs modifier should be generated when NS receives | ||
| 165 | the Function modifier (laptops). May be any of the modifier lisp symbols. */ | 175 | the Function modifier (laptops). May be any of the modifier lisp symbols. */ |
| 166 | Lisp_Object ns_function_modifier; | 176 | Lisp_Object ns_function_modifier; |
| 167 | 177 | ||
| @@ -224,6 +234,8 @@ static BOOL inNsSelect = 0; | |||
| 224 | /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ | 234 | /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ |
| 225 | #define NS_FUNCTION_KEY_MASK 0x800000 | 235 | #define NS_FUNCTION_KEY_MASK 0x800000 |
| 226 | #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) | 236 | #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) |
| 237 | #define NSRightControlKeyMask (0x002000 | NSControlKeyMask) | ||
| 238 | #define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) | ||
| 227 | #define EV_MODIFIERS(e) \ | 239 | #define EV_MODIFIERS(e) \ |
| 228 | ((([e modifierFlags] & NSHelpKeyMask) ? \ | 240 | ((([e modifierFlags] & NSHelpKeyMask) ? \ |
| 229 | hyper_modifier : 0) \ | 241 | hyper_modifier : 0) \ |
| @@ -235,10 +247,18 @@ static BOOL inNsSelect = 0; | |||
| 235 | parse_solitary_modifier (ns_alternate_modifier) : 0) \ | 247 | parse_solitary_modifier (ns_alternate_modifier) : 0) \ |
| 236 | | (([e modifierFlags] & NSShiftKeyMask) ? \ | 248 | | (([e modifierFlags] & NSShiftKeyMask) ? \ |
| 237 | shift_modifier : 0) \ | 249 | shift_modifier : 0) \ |
| 250 | | (!EQ (ns_right_control_modifier, Qleft) && \ | ||
| 251 | (([e modifierFlags] & NSRightControlKeyMask) \ | ||
| 252 | == NSRightControlKeyMask) ? \ | ||
| 253 | parse_solitary_modifier (ns_right_control_modifier) : 0) \ | ||
| 238 | | (([e modifierFlags] & NSControlKeyMask) ? \ | 254 | | (([e modifierFlags] & NSControlKeyMask) ? \ |
| 239 | parse_solitary_modifier (ns_control_modifier) : 0) \ | 255 | parse_solitary_modifier (ns_control_modifier) : 0) \ |
| 240 | | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ | 256 | | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ |
| 241 | parse_solitary_modifier (ns_function_modifier) : 0) \ | 257 | parse_solitary_modifier (ns_function_modifier) : 0) \ |
| 258 | | (!EQ (ns_right_command_modifier, Qleft) && \ | ||
| 259 | (([e modifierFlags] & NSRightCommandKeyMask) \ | ||
| 260 | == NSRightCommandKeyMask) ? \ | ||
| 261 | parse_solitary_modifier (ns_right_command_modifier) : 0) \ | ||
| 242 | | (([e modifierFlags] & NSCommandKeyMask) ? \ | 262 | | (([e modifierFlags] & NSCommandKeyMask) ? \ |
| 243 | parse_solitary_modifier (ns_command_modifier):0)) | 263 | parse_solitary_modifier (ns_command_modifier):0)) |
| 244 | 264 | ||
| @@ -4424,7 +4444,14 @@ ns_term_shutdown (int sig) | |||
| 4424 | 4444 | ||
| 4425 | if (flags & NSCommandKeyMask) | 4445 | if (flags & NSCommandKeyMask) |
| 4426 | { | 4446 | { |
| 4427 | emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); | 4447 | if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask |
| 4448 | && !EQ (ns_right_command_modifier, Qleft)) | ||
| 4449 | emacs_event->modifiers |= parse_solitary_modifier | ||
| 4450 | (ns_right_command_modifier); | ||
| 4451 | else | ||
| 4452 | emacs_event->modifiers |= parse_solitary_modifier | ||
| 4453 | (ns_command_modifier); | ||
| 4454 | |||
| 4428 | /* if super (default), take input manager's word so things like | 4455 | /* if super (default), take input manager's word so things like |
| 4429 | dvorak / qwerty layout work */ | 4456 | dvorak / qwerty layout work */ |
| 4430 | if (EQ (ns_command_modifier, Qsuper) | 4457 | if (EQ (ns_command_modifier, Qsuper) |
| @@ -4458,8 +4485,15 @@ ns_term_shutdown (int sig) | |||
| 4458 | } | 4485 | } |
| 4459 | 4486 | ||
| 4460 | if (flags & NSControlKeyMask) | 4487 | if (flags & NSControlKeyMask) |
| 4461 | emacs_event->modifiers |= | 4488 | { |
| 4462 | parse_solitary_modifier (ns_control_modifier); | 4489 | if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask |
| 4490 | && !EQ (ns_right_control_modifier, Qleft)) | ||
| 4491 | emacs_event->modifiers |= parse_solitary_modifier | ||
| 4492 | (ns_right_control_modifier); | ||
| 4493 | else | ||
| 4494 | emacs_event->modifiers |= parse_solitary_modifier | ||
| 4495 | (ns_control_modifier); | ||
| 4496 | } | ||
| 4463 | 4497 | ||
| 4464 | if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) | 4498 | if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) |
| 4465 | emacs_event->modifiers |= | 4499 | emacs_event->modifiers |= |
| @@ -6246,11 +6280,27 @@ at all, allowing it to be used at a lower level for accented character entry."); | |||
| 6246 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); | 6280 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); |
| 6247 | ns_command_modifier = Qsuper; | 6281 | ns_command_modifier = Qsuper; |
| 6248 | 6282 | ||
| 6283 | DEFVAR_LISP ("ns-right-command-modifier", &ns_right_command_modifier, | ||
| 6284 | "This variable describes the behavior of the right command key.\n\ | ||
| 6285 | Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ | ||
| 6286 | Set to left means be the same key as `ns-command-modifier'.\n\ | ||
| 6287 | Set to none means that the command / option key is not interpreted by Emacs\n\ | ||
| 6288 | at all, allowing it to be used at a lower level for accented character entry."); | ||
| 6289 | ns_right_command_modifier = Qleft; | ||
| 6290 | |||
| 6249 | DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, | 6291 | DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, |
| 6250 | "This variable describes the behavior of the control key.\n\ | 6292 | "This variable describes the behavior of the control key.\n\ |
| 6251 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); | 6293 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); |
| 6252 | ns_control_modifier = Qcontrol; | 6294 | ns_control_modifier = Qcontrol; |
| 6253 | 6295 | ||
| 6296 | DEFVAR_LISP ("ns-right-control-modifier", &ns_right_control_modifier, | ||
| 6297 | "This variable describes the behavior of the right control key.\n\ | ||
| 6298 | Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ | ||
| 6299 | Set to left means be the same key as `ns-control-modifier'.\n\ | ||
| 6300 | Set to none means that the control / option key is not interpreted by Emacs\n\ | ||
| 6301 | at all, allowing it to be used at a lower level for accented character entry."); | ||
| 6302 | ns_right_control_modifier = Qleft; | ||
| 6303 | |||
| 6254 | DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, | 6304 | DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, |
| 6255 | "This variable describes the behavior of the function key (on laptops).\n\ | 6305 | "This variable describes the behavior of the function key (on laptops).\n\ |
| 6256 | Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ | 6306 | Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ |