diff options
| -rw-r--r-- | doc/emacs/macos.texi | 60 | ||||
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/cus-start.el | 97 | ||||
| -rw-r--r-- | src/nsterm.m | 150 |
4 files changed, 241 insertions, 72 deletions
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index d9920957ad7..87484f00e40 100644 --- a/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi | |||
| @@ -48,18 +48,8 @@ Support}), but we hope to improve it in the future. | |||
| 48 | Emacs provides a set of key bindings using this modifier key that mimic | 48 | Emacs provides a set of key bindings using this modifier key that mimic |
| 49 | other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You | 49 | other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You |
| 50 | can change these bindings in the usual way (@pxref{Key Bindings}). | 50 | can change these bindings in the usual way (@pxref{Key Bindings}). |
| 51 | 51 | The modifiers themselves can be customized; | |
| 52 | @vindex ns-alternate-modifier | 52 | @pxref{Mac / GNUstep Customization}. |
| 53 | @vindex ns-right-alternate-modifier | ||
| 54 | The variable @code{ns-right-alternate-modifier} controls the | ||
| 55 | behavior of the right @key{Alt} and @key{Option} keys. These keys | ||
| 56 | behave like the left-hand keys if the value is @code{left} (the | ||
| 57 | default). A value of @code{control}, @code{meta}, @code{alt}, | ||
| 58 | @code{super}, or @code{hyper} makes them behave like the corresponding | ||
| 59 | modifier keys; a value of @code{left} means be the same key as | ||
| 60 | @code{ns-alternate-modifier}; a value of @code{none} tells Emacs to | ||
| 61 | ignore them, in which case you get the default behavior of macOS | ||
| 62 | accentuation system from the right @key{Option} key. | ||
| 63 | 53 | ||
| 64 | @kbd{S-mouse-1} adjusts the region to the click position, | 54 | @kbd{S-mouse-1} adjusts the region to the click position, |
| 65 | just like @kbd{mouse-3} (@code{mouse-save-then-kill}); it does not pop | 55 | just like @kbd{mouse-3} (@code{mouse-save-then-kill}); it does not pop |
| @@ -107,6 +97,52 @@ Nextstep port. For example, they affect things such as the modifier | |||
| 107 | keys and the fullscreen behavior. To see all such options, use | 97 | keys and the fullscreen behavior. To see all such options, use |
| 108 | @kbd{M-x customize-group @key{RET} ns @key{RET}}. | 98 | @kbd{M-x customize-group @key{RET} ns @key{RET}}. |
| 109 | 99 | ||
| 100 | @subsection Modifier keys | ||
| 101 | |||
| 102 | The following variables control the behaviour of the actual modifier | ||
| 103 | keys: | ||
| 104 | |||
| 105 | @table @code | ||
| 106 | @vindex ns-alternate-modifier | ||
| 107 | @vindex ns-right-alternate-modifier | ||
| 108 | @item ns-alternate-modifier | ||
| 109 | @itemx ns-right-alternate-modifier | ||
| 110 | The left and right @key{Option} or @key{Alt} keys. | ||
| 111 | |||
| 112 | @vindex ns-command-modifier | ||
| 113 | @vindex ns-right-command-modifier | ||
| 114 | @item ns-command-modifier | ||
| 115 | @itemx ns-right-command-modifier | ||
| 116 | The left and right @key{Command} keys. | ||
| 117 | |||
| 118 | @vindex ns-control-modifier | ||
| 119 | @vindex ns-right-control-modifier | ||
| 120 | @item ns-control-modifier | ||
| 121 | @itemx ns-right-control-modifier | ||
| 122 | The left and right @key{Control} keys. | ||
| 123 | |||
| 124 | @vindex ns-function-modifier | ||
| 125 | @item ns-function-modifier | ||
| 126 | The @key{Function} (fn) key. | ||
| 127 | @end table | ||
| 128 | |||
| 129 | The value of each variable is either a symbol, describing the key for | ||
| 130 | any purpose, or a list of the form | ||
| 131 | @code{(:ordinary @var{symbol} :function @var{symbol} :mouse @var{symbol})}, | ||
| 132 | which describes the modifier when used with ordinary keys, function keys | ||
| 133 | (that do not produce a character, such as arrow keys), and mouse clicks. | ||
| 134 | |||
| 135 | If the @var{symbol} is one of @code{control}, @code{meta}, @code{alt}, | ||
| 136 | @code{super} or @code{hyper}, this describes the Emacs modifier it | ||
| 137 | represents. If @var{symbol} is @code{none}, Emacs does not use the | ||
| 138 | key, which retains its standard behaviour. For instance, the | ||
| 139 | @key{Option} key in macOS is then used for composing additional | ||
| 140 | characters. | ||
| 141 | |||
| 142 | The variables for right-hand keys, like @code{ns-right-alternate-modifier}, | ||
| 143 | may also be set to @code{left}, which means to use the same behaviour as | ||
| 144 | the corresponding left-hand key. | ||
| 145 | |||
| 110 | @subsection Font Panel | 146 | @subsection Font Panel |
| 111 | 147 | ||
| 112 | @findex ns-popup-font-panel | 148 | @findex ns-popup-font-panel |
| @@ -3273,6 +3273,12 @@ Previously it was supported only in the Cygwin-w32 build. | |||
| 3273 | ** Emacs now handles key combinations involving the macOS "command" | 3273 | ** Emacs now handles key combinations involving the macOS "command" |
| 3274 | and "option" modifier keys more correctly. | 3274 | and "option" modifier keys more correctly. |
| 3275 | 3275 | ||
| 3276 | ** MacOS modifier key behaviour is now more adjustable. | ||
| 3277 | The behaviour of the macOS "Option", "Command", "Control" and | ||
| 3278 | "Function" keys can now be specified separately for use with | ||
| 3279 | ordinary keys, function keys and mouse clicks. This allows using them | ||
| 3280 | in their standard macOS way for composing characters. | ||
| 3281 | |||
| 3276 | ** The special handling of 'frame-title-format' on NS where setting it | 3282 | ** The special handling of 'frame-title-format' on NS where setting it |
| 3277 | to 't' would enable the macOS proxy icon has been replaced with a | 3283 | to 't' would enable the macOS proxy icon has been replaced with a |
| 3278 | separate variable, 'ns-use-proxy-icon'. 'frame-title-format' will now | 3284 | separate variable, 'ns-use-proxy-icon'. 'frame-title-format' will now |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index e4b6d8f2d62..1c497ee5ae7 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -424,16 +424,23 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 424 | ;; msdos.c | 424 | ;; msdos.c |
| 425 | (dos-unsupported-char-glyph display integer) | 425 | (dos-unsupported-char-glyph display integer) |
| 426 | ;; nsterm.m | 426 | ;; nsterm.m |
| 427 | ;; | ||
| 428 | ;; FIXME: Why does ⌃ use nil instead of none? Also the | ||
| 429 | ;; description is confusing; setting it to nil disables ⌃ | ||
| 430 | ;; entirely. | ||
| 431 | (ns-control-modifier | 427 | (ns-control-modifier |
| 432 | ns | 428 | ns |
| 433 | (choice (const :tag "No modifier" nil) | 429 | (choice (const :tag "No modifier" none) |
| 434 | (const control) (const meta) | 430 | (const control) (const meta) |
| 435 | (const alt) (const hyper) | 431 | (const alt) (const hyper) |
| 436 | (const super)) "23.1") | 432 | (const super) |
| 433 | (plist :key-type (choice (const :ordinary) | ||
| 434 | (const :function) | ||
| 435 | (const :mouse)) | ||
| 436 | :value-type (choice (const control) | ||
| 437 | (const meta) | ||
| 438 | (const alt) | ||
| 439 | (const hyper) | ||
| 440 | (const super) | ||
| 441 | (const :tag "No modifier" | ||
| 442 | none)))) | ||
| 443 | "23.1") | ||
| 437 | (ns-right-control-modifier | 444 | (ns-right-control-modifier |
| 438 | ns | 445 | ns |
| 439 | (choice (const :tag "No modifier (work as control)" none) | 446 | (choice (const :tag "No modifier (work as control)" none) |
| @@ -441,13 +448,35 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 441 | left) | 448 | left) |
| 442 | (const control) (const meta) | 449 | (const control) (const meta) |
| 443 | (const alt) (const hyper) | 450 | (const alt) (const hyper) |
| 444 | (const super)) "24.1") | 451 | (const super) |
| 452 | (plist :key-type (choice (const :ordinary) | ||
| 453 | (const :function) | ||
| 454 | (const :mouse)) | ||
| 455 | :value-type (choice (const control) | ||
| 456 | (const meta) | ||
| 457 | (const alt) | ||
| 458 | (const hyper) | ||
| 459 | (const super) | ||
| 460 | (const :tag "No modifier" | ||
| 461 | none)))) | ||
| 462 | "24.1") | ||
| 445 | (ns-command-modifier | 463 | (ns-command-modifier |
| 446 | ns | 464 | ns |
| 447 | (choice (const :tag "No modifier (work as layout switch)" none) | 465 | (choice (const :tag "No modifier (work as layout switch)" none) |
| 448 | (const control) (const meta) | 466 | (const control) (const meta) |
| 449 | (const alt) (const hyper) | 467 | (const alt) (const hyper) |
| 450 | (const super)) "23.1") | 468 | (const super) |
| 469 | (plist :key-type (choice (const :ordinary) | ||
| 470 | (const :function) | ||
| 471 | (const :mouse)) | ||
| 472 | :value-type (choice (const control) | ||
| 473 | (const meta) | ||
| 474 | (const alt) | ||
| 475 | (const hyper) | ||
| 476 | (const super) | ||
| 477 | (const :tag "No modifier" | ||
| 478 | none)))) | ||
| 479 | "23.1") | ||
| 451 | (ns-right-command-modifier | 480 | (ns-right-command-modifier |
| 452 | ns | 481 | ns |
| 453 | (choice (const :tag "No modifier (work as layout switch)" none) | 482 | (choice (const :tag "No modifier (work as layout switch)" none) |
| @@ -455,13 +484,35 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 455 | left) | 484 | left) |
| 456 | (const control) (const meta) | 485 | (const control) (const meta) |
| 457 | (const alt) (const hyper) | 486 | (const alt) (const hyper) |
| 458 | (const super)) "24.1") | 487 | (const super) |
| 488 | (plist :key-type (choice (const :ordinary) | ||
| 489 | (const :function) | ||
| 490 | (const :mouse)) | ||
| 491 | :value-type (choice (const control) | ||
| 492 | (const meta) | ||
| 493 | (const alt) | ||
| 494 | (const hyper) | ||
| 495 | (const super) | ||
| 496 | (const :tag "No modifier" | ||
| 497 | none)))) | ||
| 498 | "24.1") | ||
| 459 | (ns-alternate-modifier | 499 | (ns-alternate-modifier |
| 460 | ns | 500 | ns |
| 461 | (choice (const :tag "No modifier (work as alternate/option)" none) | 501 | (choice (const :tag "No modifier (work as alternate/option)" none) |
| 462 | (const control) (const meta) | 502 | (const control) (const meta) |
| 463 | (const alt) (const hyper) | 503 | (const alt) (const hyper) |
| 464 | (const super)) "23.1") | 504 | (const super) |
| 505 | (plist :key-type (choice (const :ordinary) | ||
| 506 | (const :function) | ||
| 507 | (const :mouse)) | ||
| 508 | :value-type (choice (const control) | ||
| 509 | (const meta) | ||
| 510 | (const alt) | ||
| 511 | (const hyper) | ||
| 512 | (const super) | ||
| 513 | (const :tag "No modifier" | ||
| 514 | none)))) | ||
| 515 | "23.1") | ||
| 465 | (ns-right-alternate-modifier | 516 | (ns-right-alternate-modifier |
| 466 | ns | 517 | ns |
| 467 | (choice (const :tag "No modifier (work as alternate/option)" none) | 518 | (choice (const :tag "No modifier (work as alternate/option)" none) |
| @@ -469,13 +520,35 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 469 | left) | 520 | left) |
| 470 | (const control) (const meta) | 521 | (const control) (const meta) |
| 471 | (const alt) (const hyper) | 522 | (const alt) (const hyper) |
| 472 | (const super)) "23.3") | 523 | (const super) |
| 524 | (plist :key-type (choice (const :ordinary) | ||
| 525 | (const :function) | ||
| 526 | (const :mouse)) | ||
| 527 | :value-type (choice (const control) | ||
| 528 | (const meta) | ||
| 529 | (const alt) | ||
| 530 | (const hyper) | ||
| 531 | (const super) | ||
| 532 | (const :tag "No modifier" | ||
| 533 | none)))) | ||
| 534 | "23.3") | ||
| 473 | (ns-function-modifier | 535 | (ns-function-modifier |
| 474 | ns | 536 | ns |
| 475 | (choice (const :tag "No modifier (work as function)" none) | 537 | (choice (const :tag "No modifier (work as function)" none) |
| 476 | (const control) (const meta) | 538 | (const control) (const meta) |
| 477 | (const alt) (const hyper) | 539 | (const alt) (const hyper) |
| 478 | (const super)) "23.1") | 540 | (const super) |
| 541 | (plist :key-type (choice (const :ordinary) | ||
| 542 | (const :function) | ||
| 543 | (const :mouse)) | ||
| 544 | :value-type (choice (const control) | ||
| 545 | (const meta) | ||
| 546 | (const alt) | ||
| 547 | (const hyper) | ||
| 548 | (const super) | ||
| 549 | (const :tag "No modifier" | ||
| 550 | none)))) | ||
| 551 | "23.1") | ||
| 479 | (ns-antialias-text ns boolean "23.1") | 552 | (ns-antialias-text ns boolean "23.1") |
| 480 | (ns-auto-hide-menu-bar ns boolean "24.1") | 553 | (ns-auto-hide-menu-bar ns boolean "24.1") |
| 481 | (ns-confirm-quit ns boolean "25.1") | 554 | (ns-confirm-quit ns boolean "25.1") |
diff --git a/src/nsterm.m b/src/nsterm.m index e1d745e332d..52a9830be82 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -354,6 +354,19 @@ static CGPoint menu_mouse_point; | |||
| 354 | #define NSLeftAlternateKeyMask (0x000020 | NSEventModifierFlagOption) | 354 | #define NSLeftAlternateKeyMask (0x000020 | NSEventModifierFlagOption) |
| 355 | #define NSRightAlternateKeyMask (0x000040 | NSEventModifierFlagOption) | 355 | #define NSRightAlternateKeyMask (0x000040 | NSEventModifierFlagOption) |
| 356 | 356 | ||
| 357 | /* MODIFIER if a symbol; otherwise its property KIND, if a symbol. */ | ||
| 358 | static Lisp_Object | ||
| 359 | mod_of_kind (Lisp_Object modifier, Lisp_Object kind) | ||
| 360 | { | ||
| 361 | if (SYMBOLP (modifier)) | ||
| 362 | return modifier; | ||
| 363 | else | ||
| 364 | { | ||
| 365 | Lisp_Object val = Fplist_get (modifier, kind); | ||
| 366 | return SYMBOLP (val) ? val : Qnil; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 357 | static unsigned int | 370 | static unsigned int |
| 358 | ev_modifiers_helper (unsigned int flags, unsigned int left_mask, | 371 | ev_modifiers_helper (unsigned int flags, unsigned int left_mask, |
| 359 | unsigned int right_mask, unsigned int either_mask, | 372 | unsigned int right_mask, unsigned int either_mask, |
| @@ -380,30 +393,35 @@ ev_modifiers_helper (unsigned int flags, unsigned int left_mask, | |||
| 380 | return modifiers; | 393 | return modifiers; |
| 381 | } | 394 | } |
| 382 | 395 | ||
| 383 | #define EV_MODIFIERS2(flags) \ | 396 | #define EV_MODIFIERS2(flags, kind) \ |
| 384 | (((flags & NSEventModifierFlagHelp) ? \ | 397 | (((flags & NSEventModifierFlagHelp) ? \ |
| 385 | hyper_modifier : 0) \ | 398 | hyper_modifier : 0) \ |
| 386 | | ((flags & NSEventModifierFlagShift) ? \ | 399 | | ((flags & NSEventModifierFlagShift) ? \ |
| 387 | shift_modifier : 0) \ | 400 | shift_modifier : 0) \ |
| 388 | | ((flags & NS_FUNCTION_KEY_MASK) ? \ | 401 | | ((flags & NS_FUNCTION_KEY_MASK) \ |
| 389 | parse_solitary_modifier (ns_function_modifier) : 0) \ | 402 | ? parse_solitary_modifier (mod_of_kind (ns_function_modifier, \ |
| 403 | kind)) \ | ||
| 404 | : 0) \ | ||
| 390 | | ev_modifiers_helper (flags, NSLeftControlKeyMask, \ | 405 | | ev_modifiers_helper (flags, NSLeftControlKeyMask, \ |
| 391 | NSRightControlKeyMask, \ | 406 | NSRightControlKeyMask, \ |
| 392 | NSEventModifierFlagControl, \ | 407 | NSEventModifierFlagControl, \ |
| 393 | ns_control_modifier, \ | 408 | mod_of_kind (ns_control_modifier, kind), \ |
| 394 | ns_right_control_modifier) \ | 409 | mod_of_kind (ns_right_control_modifier, \ |
| 410 | kind)) \ | ||
| 395 | | ev_modifiers_helper (flags, NSLeftCommandKeyMask, \ | 411 | | ev_modifiers_helper (flags, NSLeftCommandKeyMask, \ |
| 396 | NSRightCommandKeyMask, \ | 412 | NSRightCommandKeyMask, \ |
| 397 | NSEventModifierFlagCommand, \ | 413 | NSEventModifierFlagCommand, \ |
| 398 | ns_command_modifier, \ | 414 | mod_of_kind (ns_command_modifier, kind), \ |
| 399 | ns_right_command_modifier) \ | 415 | mod_of_kind (ns_right_command_modifier, \ |
| 416 | kind)) \ | ||
| 400 | | ev_modifiers_helper (flags, NSLeftAlternateKeyMask, \ | 417 | | ev_modifiers_helper (flags, NSLeftAlternateKeyMask, \ |
| 401 | NSRightAlternateKeyMask, \ | 418 | NSRightAlternateKeyMask, \ |
| 402 | NSEventModifierFlagOption, \ | 419 | NSEventModifierFlagOption, \ |
| 403 | ns_alternate_modifier, \ | 420 | mod_of_kind (ns_alternate_modifier, kind), \ |
| 404 | ns_right_alternate_modifier)) | 421 | mod_of_kind (ns_right_alternate_modifier, \ |
| 422 | kind))) | ||
| 405 | 423 | ||
| 406 | #define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags]) | 424 | #define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags], QCmouse) |
| 407 | 425 | ||
| 408 | #define EV_UDMODIFIERS(e) \ | 426 | #define EV_UDMODIFIERS(e) \ |
| 409 | ((([e type] == NSEventTypeLeftMouseDown) ? down_modifier : 0) \ | 427 | ((([e type] == NSEventTypeLeftMouseDown) ? down_modifier : 0) \ |
| @@ -2599,6 +2617,18 @@ get_keysym_name (int keysym) | |||
| 2599 | } | 2617 | } |
| 2600 | 2618 | ||
| 2601 | #ifdef NS_IMPL_COCOA | 2619 | #ifdef NS_IMPL_COCOA |
| 2620 | static Lisp_Object | ||
| 2621 | right_mod (Lisp_Object left, Lisp_Object right) | ||
| 2622 | { | ||
| 2623 | return EQ (right, Qleft) ? left : right; | ||
| 2624 | } | ||
| 2625 | |||
| 2626 | static bool | ||
| 2627 | nil_or_none (Lisp_Object val) | ||
| 2628 | { | ||
| 2629 | return NILP (val) || EQ (val, Qnone); | ||
| 2630 | } | ||
| 2631 | |||
| 2602 | static UniChar | 2632 | static UniChar |
| 2603 | ns_get_shifted_character (NSEvent *event) | 2633 | ns_get_shifted_character (NSEvent *event) |
| 2604 | /* Look up the character corresponding to the key pressed on the | 2634 | /* Look up the character corresponding to the key pressed on the |
| @@ -2630,25 +2660,25 @@ ns_get_shifted_character (NSEvent *event) | |||
| 2630 | NSTRACE ("ns_get_shifted_character"); | 2660 | NSTRACE ("ns_get_shifted_character"); |
| 2631 | 2661 | ||
| 2632 | if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask | 2662 | if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask |
| 2633 | && (EQ (ns_right_alternate_modifier, Qnone) | 2663 | && nil_or_none (mod_of_kind (right_mod (ns_alternate_modifier, |
| 2634 | || (EQ (ns_right_alternate_modifier, Qleft) | 2664 | ns_right_alternate_modifier), |
| 2635 | && EQ (ns_alternate_modifier, Qnone)))) | 2665 | QCordinary))) |
| 2636 | modifiers |= rightOptionKey; | 2666 | modifiers |= rightOptionKey; |
| 2637 | 2667 | ||
| 2638 | if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask | 2668 | if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask |
| 2639 | && EQ (ns_alternate_modifier, Qnone)) | 2669 | && nil_or_none (mod_of_kind (ns_alternate_modifier, QCordinary))) |
| 2640 | modifiers |= optionKey; | 2670 | modifiers |= optionKey; |
| 2641 | 2671 | ||
| 2642 | if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask | 2672 | if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask |
| 2643 | && (EQ (ns_right_command_modifier, Qnone) | 2673 | && nil_or_none (mod_of_kind (right_mod (ns_command_modifier, |
| 2644 | || (EQ (ns_right_command_modifier, Qleft) | 2674 | ns_right_command_modifier), |
| 2645 | && EQ (ns_command_modifier, Qnone)))) | 2675 | QCordinary))) |
| 2646 | /* Carbon doesn't differentiate between left and right command | 2676 | /* Carbon doesn't differentiate between left and right command |
| 2647 | keys. */ | 2677 | keys. */ |
| 2648 | modifiers |= cmdKey; | 2678 | modifiers |= cmdKey; |
| 2649 | 2679 | ||
| 2650 | if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask | 2680 | if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask |
| 2651 | && EQ (ns_command_modifier, Qnone)) | 2681 | && nil_or_none (mod_of_kind (ns_command_modifier, QCordinary))) |
| 2652 | modifiers |= cmdKey; | 2682 | modifiers |= cmdKey; |
| 2653 | 2683 | ||
| 2654 | result = UCKeyTranslate (layout, [event keyCode], kUCKeyActionDown, | 2684 | result = UCKeyTranslate (layout, [event keyCode], kUCKeyActionDown, |
| @@ -6287,7 +6317,8 @@ not_in_argv (NSString *arg) | |||
| 6287 | modifier keys, which returns 0 for shift-like modifiers. | 6317 | modifier keys, which returns 0 for shift-like modifiers. |
| 6288 | Therefore its return value is the set of control-like | 6318 | Therefore its return value is the set of control-like |
| 6289 | modifiers. */ | 6319 | modifiers. */ |
| 6290 | emacs_event->modifiers = EV_MODIFIERS2 (flags); | 6320 | Lisp_Object kind = fnKeysym ? QCfunction : QCordinary; |
| 6321 | emacs_event->modifiers = EV_MODIFIERS2 (flags, kind); | ||
| 6291 | 6322 | ||
| 6292 | /* Function keys (such as the F-keys, arrow keys, etc.) set | 6323 | /* Function keys (such as the F-keys, arrow keys, etc.) set |
| 6293 | modifiers as though the fn key has been pressed when it | 6324 | modifiers as though the fn key has been pressed when it |
| @@ -6296,7 +6327,9 @@ not_in_argv (NSString *arg) | |||
| 6296 | <home>). We need to unset the fn modifier in these cases. | 6327 | <home>). We need to unset the fn modifier in these cases. |
| 6297 | FIXME: Can we avoid setting it in the first place? */ | 6328 | FIXME: Can we avoid setting it in the first place? */ |
| 6298 | if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) | 6329 | if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) |
| 6299 | emacs_event->modifiers ^= parse_solitary_modifier (ns_function_modifier); | 6330 | emacs_event->modifiers |
| 6331 | ^= parse_solitary_modifier (mod_of_kind (ns_function_modifier, | ||
| 6332 | QCfunction)); | ||
| 6300 | 6333 | ||
| 6301 | if (NS_KEYLOG) | 6334 | if (NS_KEYLOG) |
| 6302 | fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", | 6335 | fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", |
| @@ -9399,57 +9432,75 @@ syms_of_nsterm (void) | |||
| 9399 | 9432 | ||
| 9400 | DEFVAR_LISP ("ns-alternate-modifier", ns_alternate_modifier, | 9433 | DEFVAR_LISP ("ns-alternate-modifier", ns_alternate_modifier, |
| 9401 | "This variable describes the behavior of the alternate or option key.\n\ | 9434 | "This variable describes the behavior of the alternate or option key.\n\ |
| 9402 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9435 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9403 | that key.\n\ | 9436 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9404 | Set to none means that the alternate / option key is not interpreted by Emacs\n\ | 9437 | separately for ordinary keys, function keys, and mouse events.\n\ |
| 9405 | at all, allowing it to be used at a lower level for accented character entry."); | 9438 | \n\ |
| 9439 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9440 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9406 | ns_alternate_modifier = Qmeta; | 9441 | ns_alternate_modifier = Qmeta; |
| 9407 | 9442 | ||
| 9408 | DEFVAR_LISP ("ns-right-alternate-modifier", ns_right_alternate_modifier, | 9443 | DEFVAR_LISP ("ns-right-alternate-modifier", ns_right_alternate_modifier, |
| 9409 | "This variable describes the behavior of the right alternate or option key.\n\ | 9444 | "This variable describes the behavior of the right alternate or option key.\n\ |
| 9410 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9445 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9411 | that key.\n\ | 9446 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9412 | Set to left means be the same key as `ns-alternate-modifier'.\n\ | 9447 | separately for ordinary keys, function keys, and mouse events.\n\ |
| 9413 | Set to none means that the alternate / option key is not interpreted by Emacs\n\ | 9448 | It can also be `left' to use the value of `ns-alternate-modifier' instead.\n\ |
| 9414 | at all, allowing it to be used at a lower level for accented character entry."); | 9449 | \n\ |
| 9450 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9451 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9415 | ns_right_alternate_modifier = Qleft; | 9452 | ns_right_alternate_modifier = Qleft; |
| 9416 | 9453 | ||
| 9417 | DEFVAR_LISP ("ns-command-modifier", ns_command_modifier, | 9454 | DEFVAR_LISP ("ns-command-modifier", ns_command_modifier, |
| 9418 | "This variable describes the behavior of the command key.\n\ | 9455 | "This variable describes the behavior of the command key.\n\ |
| 9419 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9456 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9420 | that key."); | 9457 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9458 | separately for ordinary keys, function keys, and mouse events.\n\ | ||
| 9459 | \n\ | ||
| 9460 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9461 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9421 | ns_command_modifier = Qsuper; | 9462 | ns_command_modifier = Qsuper; |
| 9422 | 9463 | ||
| 9423 | DEFVAR_LISP ("ns-right-command-modifier", ns_right_command_modifier, | 9464 | DEFVAR_LISP ("ns-right-command-modifier", ns_right_command_modifier, |
| 9424 | "This variable describes the behavior of the right command key.\n\ | 9465 | "This variable describes the behavior of the right command key.\n\ |
| 9425 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9466 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9426 | that key.\n\ | 9467 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9427 | Set to left means be the same key as `ns-command-modifier'.\n\ | 9468 | separately for ordinary keys, function keys, and mouse events.\n\ |
| 9428 | Set to none means that the command / option key is not interpreted by Emacs\n\ | 9469 | It can also be `left' to use the value of `ns-command-modifier' instead.\n\ |
| 9429 | at all, allowing it to be used at a lower level for accented character entry."); | 9470 | \n\ |
| 9471 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9472 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9430 | ns_right_command_modifier = Qleft; | 9473 | ns_right_command_modifier = Qleft; |
| 9431 | 9474 | ||
| 9432 | DEFVAR_LISP ("ns-control-modifier", ns_control_modifier, | 9475 | DEFVAR_LISP ("ns-control-modifier", ns_control_modifier, |
| 9433 | "This variable describes the behavior of the control key.\n\ | 9476 | "This variable describes the behavior of the control key.\n\ |
| 9434 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9477 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9435 | that key."); | 9478 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9479 | separately for ordinary keys, function keys, and mouse events.\n\ | ||
| 9480 | \n\ | ||
| 9481 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9482 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9436 | ns_control_modifier = Qcontrol; | 9483 | ns_control_modifier = Qcontrol; |
| 9437 | 9484 | ||
| 9438 | DEFVAR_LISP ("ns-right-control-modifier", ns_right_control_modifier, | 9485 | DEFVAR_LISP ("ns-right-control-modifier", ns_right_control_modifier, |
| 9439 | "This variable describes the behavior of the right control key.\n\ | 9486 | "This variable describes the behavior of the right control key.\n\ |
| 9440 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9487 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9441 | that key.\n\ | 9488 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9442 | Set to left means be the same key as `ns-control-modifier'.\n\ | 9489 | separately for ordinary keys, function keys, and mouse events.\n\ |
| 9443 | Set to none means that the control / option key is not interpreted by Emacs\n\ | 9490 | It can also be `left' to use the value of `ns-control-modifier' instead.\n\ |
| 9444 | at all, allowing it to be used at a lower level for accented character entry."); | 9491 | \n\ |
| 9492 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9493 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9445 | ns_right_control_modifier = Qleft; | 9494 | ns_right_control_modifier = Qleft; |
| 9446 | 9495 | ||
| 9447 | DEFVAR_LISP ("ns-function-modifier", ns_function_modifier, | 9496 | DEFVAR_LISP ("ns-function-modifier", ns_function_modifier, |
| 9448 | "This variable describes the behavior of the function key (on laptops).\n\ | 9497 | "This variable describes the behavior of the function (fn) key.\n\ |
| 9449 | Set to the symbol control, meta, alt, super, or hyper means it is taken to be\n\ | 9498 | Either SYMBOL, describing the behaviour for any event,\n\ |
| 9450 | that key.\n\ | 9499 | or (:ordinary SYMBOL :function SYMBOL :mouse SYMBOL), describing behaviour\n\ |
| 9451 | Set to none means that the function key is not interpreted by Emacs at all,\n\ | 9500 | separately for ordinary keys, function keys, and mouse events.\n\ |
| 9452 | allowing it to be used at a lower level for accented character entry."); | 9501 | \n\ |
| 9502 | Each SYMBOL is `control', `meta', `alt', `super', `hyper' or `none'.\n\ | ||
| 9503 | If `none', the key is ignored by Emacs and retains its standard meaning."); | ||
| 9453 | ns_function_modifier = Qnone; | 9504 | ns_function_modifier = Qnone; |
| 9454 | 9505 | ||
| 9455 | DEFVAR_LISP ("ns-antialias-text", ns_antialias_text, | 9506 | DEFVAR_LISP ("ns-antialias-text", ns_antialias_text, |
| @@ -9529,6 +9580,9 @@ This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | |||
| 9529 | 9580 | ||
| 9530 | DEFSYM (Qcocoa, "cocoa"); | 9581 | DEFSYM (Qcocoa, "cocoa"); |
| 9531 | DEFSYM (Qgnustep, "gnustep"); | 9582 | DEFSYM (Qgnustep, "gnustep"); |
| 9583 | DEFSYM (QCordinary, ":ordinary"); | ||
| 9584 | DEFSYM (QCfunction, ":function"); | ||
| 9585 | DEFSYM (QCmouse, ":mouse"); | ||
| 9532 | 9586 | ||
| 9533 | #ifdef NS_IMPL_COCOA | 9587 | #ifdef NS_IMPL_COCOA |
| 9534 | Fprovide (Qcocoa, Qnil); | 9588 | Fprovide (Qcocoa, Qnil); |