diff options
| author | Jan Djärv | 2010-10-11 21:18:08 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-10-11 21:18:08 +0200 |
| commit | a2e35ef5d52031e0fa184d1863fe7cb7043ef637 (patch) | |
| tree | 0e4178b0a917a2ed632776bb769b07482af2ab9a | |
| parent | 9386ae128af79d61278bd3686d56f3624f9cc5bd (diff) | |
| download | emacs-a2e35ef5d52031e0fa184d1863fe7cb7043ef637.tar.gz emacs-a2e35ef5d52031e0fa184d1863fe7cb7043ef637.zip | |
Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
* lisp/cus-start.el (all): ns-right-alternate-modifier is new.
* lisp/term/ns-win.el (ns-right-alternate-modifier): New defvar.
(ns-right-option-modifier): New alias for ns-right-alternate-modifier.
(mac-right-option-modifier): New alias for ns-right-option-modifier.
* src/nsterm.m (Qleft): Declare.
(ns_right_alternate_modifier): New variable
(NSRightAlternateKeyMask): New define.
(EV_MODIFIERS): Parse NSRightAlternateKeyMask if
ns_right_alternate_modifier isn't Qleft.
(keyDown): If ns_right_alternate_modifier isn't Qleft, use it
as emacs modifier for NSRightAlternateKeyMask.
(syms_of_nsterm): DEFVAR_LISP ns-right-alternate-modifier.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/cus-start.el | 8 | ||||
| -rw-r--r-- | lisp/term/ns-win.el | 3 | ||||
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/nsterm.m | 32 |
6 files changed, 61 insertions, 4 deletions
| @@ -21,6 +21,9 @@ with a prefix argument or by typing C-u C-h C-n. | |||
| 21 | 21 | ||
| 22 | * Changes in Emacs 23.3 | 22 | * Changes in Emacs 23.3 |
| 23 | 23 | ||
| 24 | ** The nextstep port can have different modifiers for the left and right | ||
| 25 | alt/option key by customizing the value for ns-right-alternate-modifier. | ||
| 26 | |||
| 24 | 27 | ||
| 25 | * Editing Changes in Emacs 23.3 | 28 | * Editing Changes in Emacs 23.3 |
| 26 | 29 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 867972ed140..f3275116a9b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-10-10 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * term/ns-win.el (ns-right-alternate-modifier): New defvar. | ||
| 4 | (ns-right-option-modifier): New alias for ns-right-alternate-modifier. | ||
| 5 | (mac-right-option-modifier): New alias for ns-right-option-modifier. | ||
| 6 | |||
| 7 | * cus-start.el (all): ns-right-alternate-modifier is new. | ||
| 8 | |||
| 1 | 2010-10-10 Andreas Schwab <schwab@linux-m68k.org> | 9 | 2010-10-10 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 10 | ||
| 3 | * Makefile.in (ELCFILES): Update. | 11 | * Makefile.in (ELCFILES): Update. |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 30678a09bb8..0f686a434e0 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -266,6 +266,14 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 266 | (const control) (const meta) | 266 | (const control) (const meta) |
| 267 | (const alt) (const hyper) | 267 | (const alt) (const hyper) |
| 268 | (const super)) "23.1") | 268 | (const super)) "23.1") |
| 269 | (ns-right-alternate-modifier | ||
| 270 | ns | ||
| 271 | (choice (const :tag "No modifier (work as alternate/option)" none) | ||
| 272 | (const :tag "Use the value of ns-alternate-modifier" | ||
| 273 | left) | ||
| 274 | (const control) (const meta) | ||
| 275 | (const alt) (const hyper) | ||
| 276 | (const super)) "23.3") | ||
| 269 | (ns-function-modifier | 277 | (ns-function-modifier |
| 270 | ns | 278 | ns |
| 271 | (choice (const :tag "No modifier (work as function)" none) | 279 | (choice (const :tag "No modifier (work as function)" none) |
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index a53d0346d94..b9177b2b432 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | ;; nsterm.m | 66 | ;; nsterm.m |
| 67 | (defvar ns-version-string) | 67 | (defvar ns-version-string) |
| 68 | (defvar ns-alternate-modifier) | 68 | (defvar ns-alternate-modifier) |
| 69 | (defvar ns-right-alternate-modifier) | ||
| 69 | 70 | ||
| 70 | ;;;; Command line argument handling. | 71 | ;;;; Command line argument handling. |
| 71 | 72 | ||
| @@ -286,6 +287,7 @@ The properties returned may include `top', `left', `height', and `width'." | |||
| 286 | (defvaralias 'mac-command-modifier 'ns-command-modifier) | 287 | (defvaralias 'mac-command-modifier 'ns-command-modifier) |
| 287 | (defvaralias 'mac-control-modifier 'ns-control-modifier) | 288 | (defvaralias 'mac-control-modifier 'ns-control-modifier) |
| 288 | (defvaralias 'mac-option-modifier 'ns-option-modifier) | 289 | (defvaralias 'mac-option-modifier 'ns-option-modifier) |
| 290 | (defvaralias 'mac-right-option-modifier 'ns-right-option-modifier) | ||
| 289 | (defvaralias 'mac-function-modifier 'ns-function-modifier) | 291 | (defvaralias 'mac-function-modifier 'ns-function-modifier) |
| 290 | (declare-function ns-do-applescript "nsfns.m" (script)) | 292 | (declare-function ns-do-applescript "nsfns.m" (script)) |
| 291 | (defalias 'do-applescript 'ns-do-applescript) | 293 | (defalias 'do-applescript 'ns-do-applescript) |
| @@ -817,6 +819,7 @@ unless the current buffer is a scratch buffer." | |||
| 817 | 819 | ||
| 818 | ;; You say tomAYto, I say tomAHto.. | 820 | ;; You say tomAYto, I say tomAHto.. |
| 819 | (defvaralias 'ns-option-modifier 'ns-alternate-modifier) | 821 | (defvaralias 'ns-option-modifier 'ns-alternate-modifier) |
| 822 | (defvaralias 'ns-right-option-modifier 'ns-right-alternate-modifier) | ||
| 820 | 823 | ||
| 821 | (defun ns-do-hide-emacs () | 824 | (defun ns-do-hide-emacs () |
| 822 | (interactive) | 825 | (interactive) |
diff --git a/src/ChangeLog b/src/ChangeLog index d63f417ed42..9ce5007d3b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-10-10 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (Qleft): Declare. | ||
| 4 | (ns_right_alternate_modifier): New variable | ||
| 5 | (NSRightAlternateKeyMask): New define. | ||
| 6 | (EV_MODIFIERS): Parse NSRightAlternateKeyMask if | ||
| 7 | ns_right_alternate_modifier isn't Qleft. | ||
| 8 | (keyDown): If ns_right_alternate_modifier isn't Qleft, use it | ||
| 9 | as emacs modifier for NSRightAlternateKeyMask. | ||
| 10 | (syms_of_nsterm): DEFVAR_LISP ns-right-alternate-modifier. | ||
| 11 | |||
| 1 | 2010-10-08 Michael Albinus <michael.albinus@gmx.de> | 12 | 2010-10-08 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 13 | ||
| 3 | * dbusbind.c (xd_get_dispatch_status): Return a Lisp_Object. | 14 | * dbusbind.c (xd_get_dispatch_status): Return a Lisp_Object. |
diff --git a/src/nsterm.m b/src/nsterm.m index 7c70b2ae698..fc933c099e8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -142,13 +142,18 @@ Lisp_Object ns_input_spi_name, ns_input_spi_arg; | |||
| 142 | Lisp_Object Vx_toolkit_scroll_bars; | 142 | Lisp_Object Vx_toolkit_scroll_bars; |
| 143 | static Lisp_Object Qmodifier_value; | 143 | static Lisp_Object Qmodifier_value; |
| 144 | Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone; | 144 | Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone; |
| 145 | extern Lisp_Object Qcursor_color, Qcursor_type, Qns; | 145 | extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; |
| 146 | 146 | ||
| 147 | /* Specifies which emacs modifier should be generated when NS receives | 147 | /* Specifies which emacs modifier should be generated when NS receives |
| 148 | the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ | 148 | the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ |
| 149 | Lisp_Object ns_alternate_modifier; | 149 | Lisp_Object ns_alternate_modifier; |
| 150 | 150 | ||
| 151 | /* Specifies which emacs modifier should be generated when NS receives | 151 | /* Specifies which emacs modifier should be generated when NS receives |
| 152 | the right Alternate modifer. Has same values as ns_alternate_modifier plus | ||
| 153 | the value Qleft which means whatever value ns_alternate_modifier has. */ | ||
| 154 | Lisp_Object ns_right_alternate_modifier; | ||
| 155 | |||
| 156 | /* Specifies which emacs modifier should be generated when NS receives | ||
| 152 | the Command modifer. May be any of the modifier lisp symbols. */ | 157 | the Command modifer. May be any of the modifier lisp symbols. */ |
| 153 | Lisp_Object ns_command_modifier; | 158 | Lisp_Object ns_command_modifier; |
| 154 | 159 | ||
| @@ -218,12 +223,17 @@ static BOOL inNsSelect = 0; | |||
| 218 | 223 | ||
| 219 | /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ | 224 | /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ |
| 220 | #define NS_FUNCTION_KEY_MASK 0x800000 | 225 | #define NS_FUNCTION_KEY_MASK 0x800000 |
| 226 | #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) | ||
| 221 | #define EV_MODIFIERS(e) \ | 227 | #define EV_MODIFIERS(e) \ |
| 222 | ((([e modifierFlags] & NSHelpKeyMask) ? \ | 228 | ((([e modifierFlags] & NSHelpKeyMask) ? \ |
| 223 | hyper_modifier : 0) \ | 229 | hyper_modifier : 0) \ |
| 224 | | (([e modifierFlags] & NSAlternateKeyMask) ? \ | 230 | | (!EQ (ns_right_alternate_modifier, Qleft) && \ |
| 231 | (([e modifierFlags] & NSRightAlternateKeyMask) \ | ||
| 232 | == NSRightAlternateKeyMask) ? \ | ||
| 233 | parse_solitary_modifier (ns_right_alternate_modifier) : 0) \ | ||
| 234 | | (([e modifierFlags] & NSAlternateKeyMask) ? \ | ||
| 225 | parse_solitary_modifier (ns_alternate_modifier) : 0) \ | 235 | parse_solitary_modifier (ns_alternate_modifier) : 0) \ |
| 226 | | (([e modifierFlags] & NSShiftKeyMask) ? \ | 236 | | (([e modifierFlags] & NSShiftKeyMask) ? \ |
| 227 | shift_modifier : 0) \ | 237 | shift_modifier : 0) \ |
| 228 | | (([e modifierFlags] & NSControlKeyMask) ? \ | 238 | | (([e modifierFlags] & NSControlKeyMask) ? \ |
| 229 | parse_solitary_modifier (ns_control_modifier) : 0) \ | 239 | parse_solitary_modifier (ns_control_modifier) : 0) \ |
| @@ -4423,7 +4433,13 @@ ns_term_shutdown (int sig) | |||
| 4423 | emacs_event->modifiers |= | 4433 | emacs_event->modifiers |= |
| 4424 | parse_solitary_modifier (ns_function_modifier); | 4434 | parse_solitary_modifier (ns_function_modifier); |
| 4425 | 4435 | ||
| 4426 | if (flags & NSAlternateKeyMask) /* default = meta */ | 4436 | if (!EQ (ns_right_alternate_modifier, Qleft) |
| 4437 | && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)) | ||
| 4438 | { | ||
| 4439 | emacs_event->modifiers |= parse_solitary_modifier | ||
| 4440 | (ns_right_alternate_modifier); | ||
| 4441 | } | ||
| 4442 | else if (flags & NSAlternateKeyMask) /* default = meta */ | ||
| 4427 | { | 4443 | { |
| 4428 | if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) | 4444 | if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) |
| 4429 | && !fnKeysym) | 4445 | && !fnKeysym) |
| @@ -6185,6 +6201,14 @@ Set to none means that the alternate / option key is not interpreted by Emacs\n\ | |||
| 6185 | at all, allowing it to be used at a lower level for accented character entry."); | 6201 | at all, allowing it to be used at a lower level for accented character entry."); |
| 6186 | ns_alternate_modifier = Qmeta; | 6202 | ns_alternate_modifier = Qmeta; |
| 6187 | 6203 | ||
| 6204 | DEFVAR_LISP ("ns-right-alternate-modifier", &ns_right_alternate_modifier, | ||
| 6205 | "This variable describes the behavior of the right alternate or option key.\n\ | ||
| 6206 | Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ | ||
| 6207 | Set to left means be the same key as `ns-alternate-modifier'.\n\ | ||
| 6208 | Set to none means that the alternate / option key is not interpreted by Emacs\n\ | ||
| 6209 | at all, allowing it to be used at a lower level for accented character entry."); | ||
| 6210 | ns_right_alternate_modifier = Qleft; | ||
| 6211 | |||
| 6188 | DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier, | 6212 | DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier, |
| 6189 | "This variable describes the behavior of the command key.\n\ | 6213 | "This variable describes the behavior of the command key.\n\ |
| 6190 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); | 6214 | Set to control, meta, alt, super, or hyper means it is taken to be that key."); |