aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2010-11-21 14:09:34 +0100
committerJan Djärv2010-11-21 14:09:34 +0100
commitb7d1e1444724b4f2e47df2cac9983c4f9ac0a21a (patch)
tree365d8fcd2196648bf584a54b117b4f9601e874da
parent034244e55ba9223e7929fada1c2a545c4beee95c (diff)
downloademacs-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).
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/cus-start.el16
-rw-r--r--lisp/term/ns-win.el4
-rw-r--r--src/ChangeLog11
-rw-r--r--src/nsterm.m56
5 files changed, 92 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c4bb5ec0e0f..1a4866612dc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12010-11-21 Jan Djärv <jan.h.d@swipnet.se>
2
3 * term/ns-win.el (ns-right-control-modifier)
4 (ns-right-command-modifier): Defvar them.
5
6 * cus-start.el (all): Add ns-right-control-modifier and
7 ns-right-command-modifier (Bug#7458).
8
12010-11-20 Glenn Morris <rgm@gnu.org> 92010-11-20 Glenn Morris <rgm@gnu.org>
2 10
3 * emacs-lisp/authors.el (authors-ignored-files) 11 * emacs-lisp/authors.el (authors-ignored-files)
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 750b6570158..91aa3edf384 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -320,12 +320,28 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
320 (const control) (const meta) 320 (const control) (const meta)
321 (const alt) (const hyper) 321 (const alt) (const hyper)
322 (const super)) "23.1") 322 (const super)) "23.1")
323 (ns-right-control-modifier
324 ns
325 (choice (const :tag "No modifier (work as control)" none)
326 (const :tag "Use the value of ns-control-modifier"
327 left)
328 (const control) (const meta)
329 (const alt) (const hyper)
330 (const super)) "24.0")
323 (ns-command-modifier 331 (ns-command-modifier
324 ns 332 ns
325 (choice (const :tag "No modifier" nil) 333 (choice (const :tag "No modifier" nil)
326 (const control) (const meta) 334 (const control) (const meta)
327 (const alt) (const hyper) 335 (const alt) (const hyper)
328 (const super)) "23.1") 336 (const super)) "23.1")
337 (ns-right-command-modifier
338 ns
339 (choice (const :tag "No modifier (work as command)" none)
340 (const :tag "Use the value of ns-command-modifier"
341 left)
342 (const control) (const meta)
343 (const alt) (const hyper)
344 (const super)) "24.0")
329 (ns-alternate-modifier 345 (ns-alternate-modifier
330 ns 346 ns
331 (choice (const :tag "No modifier (work as alternate/option)" none) 347 (choice (const :tag "No modifier (work as alternate/option)" none)
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 24f70f9dee0..89fcfde9358 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -179,7 +179,9 @@ The properties returned may include `top', `left', `height', and `width'."
179 179
180(defvaralias 'mac-allow-anti-aliasing 'ns-antialias-text) 180(defvaralias 'mac-allow-anti-aliasing 'ns-antialias-text)
181(defvaralias 'mac-command-modifier 'ns-command-modifier) 181(defvaralias 'mac-command-modifier 'ns-command-modifier)
182(defvaralias 'mac-right-command-modifier 'ns-right-command-modifier)
182(defvaralias 'mac-control-modifier 'ns-control-modifier) 183(defvaralias 'mac-control-modifier 'ns-control-modifier)
184(defvaralias 'mac-right-control-modifier 'ns-right-control-modifier)
183(defvaralias 'mac-option-modifier 'ns-option-modifier) 185(defvaralias 'mac-option-modifier 'ns-option-modifier)
184(defvaralias 'mac-right-option-modifier 'ns-right-option-modifier) 186(defvaralias 'mac-right-option-modifier 'ns-right-option-modifier)
185(defvaralias 'mac-function-modifier 'ns-function-modifier) 187(defvaralias 'mac-function-modifier 'ns-function-modifier)
@@ -514,6 +516,8 @@ unless the current buffer is a scratch buffer."
514;; nsterm.m 516;; nsterm.m
515(defvar ns-alternate-modifier) 517(defvar ns-alternate-modifier)
516(defvar ns-right-alternate-modifier) 518(defvar ns-right-alternate-modifier)
519(defvar ns-right-command-modifier)
520(defvar ns-right-control-modifier)
517 521
518;; You say tomAYto, I say tomAHto.. 522;; You say tomAYto, I say tomAHto..
519(defvaralias 'ns-option-modifier 'ns-alternate-modifier) 523(defvaralias 'ns-option-modifier 'ns-alternate-modifier)
diff --git a/src/ChangeLog b/src/ChangeLog
index f5ab88743b1..8a77fc15792 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12010-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
12010-11-21 Dan Nicolaescu <dann@ics.uci.edu> 122010-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;
158Lisp_Object ns_command_modifier; 158Lisp_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. */
163Lisp_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. */
162Lisp_Object ns_control_modifier; 167Lisp_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. */
172Lisp_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. */
166Lisp_Object ns_function_modifier; 176Lisp_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.");
6246Set to control, meta, alt, super, or hyper means it is taken to be that key."); 6280Set 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\
6285Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
6286Set to left means be the same key as `ns-command-modifier'.\n\
6287Set to none means that the command / option key is not interpreted by Emacs\n\
6288at 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\
6251Set to control, meta, alt, super, or hyper means it is taken to be that key."); 6293Set 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\
6298Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
6299Set to left means be the same key as `ns-control-modifier'.\n\
6300Set to none means that the control / option key is not interpreted by Emacs\n\
6301at 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\
6256Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ 6306Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\