cocoa: adjust key events for empty Ctl- combos and special Option
In particular, restore key handling that makes Ctl-Space produce an event with a Space character. Also, restore `special-option-key` support, while correcting the documentation to say what `special-option-key` and `special-control-key` actually do. Closes PR 14934
This commit is contained in:
parent
60611bc081
commit
1185faa590
|
@ -100,18 +100,9 @@ Returns the top level window in the current eventspace that is visible
|
||||||
[(special-control-key)
|
[(special-control-key)
|
||||||
boolean?])]{
|
boolean?])]{
|
||||||
|
|
||||||
Enables or disables special Control key handling (Mac OS X). When Control
|
For backward compatibility, only. This function was intended to enable
|
||||||
is treated as a special key, the system's key-mapper is called
|
or disable special Control key handling (Mac OS X), but it currently
|
||||||
without Control for keyboard translations. For some languages,
|
has no effect.
|
||||||
Control key presses must be seen by the system translation, so this
|
|
||||||
mode should be turned off, but the default is on.
|
|
||||||
|
|
||||||
If @racket[on?] is provided and @racket[#f], Control is passed to the system
|
|
||||||
translation as normal. This setting affects all windows and
|
|
||||||
eventspaces.
|
|
||||||
|
|
||||||
If no argument is provided, the result is @racket[#t] if Control is
|
|
||||||
currently treated specially, @racket[#f] otherwise.
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,14 +110,15 @@ currently treated specially, @racket[#f] otherwise.
|
||||||
void?]
|
void?]
|
||||||
[(special-option-key)
|
[(special-option-key)
|
||||||
boolean?])]{
|
boolean?])]{
|
||||||
Enables or disables special Option key handling (Mac OS X). When
|
|
||||||
Option is treated as a special key, the system's key-mapper is called
|
|
||||||
without Option for keyboard translations. By default, Option is not
|
|
||||||
special.
|
|
||||||
|
|
||||||
If @racket[on?] is provided @racket[#f], Option is passed to the
|
Enables or disables special Option key handling (Mac OS X). When
|
||||||
system translation as normal. This setting affects all windows and
|
Option is treated as a special key, the @method[key-event%
|
||||||
eventspaces.
|
get-key-code] and @method[key-event% get-other-altgr-key-code]
|
||||||
|
results are effectively swapped when the Option key is pressed. By
|
||||||
|
default, Option is not special.
|
||||||
|
|
||||||
|
If @racket[on?] is provided as @racket[#f], key events are reported
|
||||||
|
normally. This setting affects all windows and eventspaces.
|
||||||
|
|
||||||
If no argument is provided, the result is @racket[#t] if Option is
|
If no argument is provided, the result is @racket[#t] if Option is
|
||||||
currently treated specially, @racket[#f] otherwise.
|
currently treated specially, @racket[#f] otherwise.
|
||||||
|
|
|
@ -414,16 +414,22 @@
|
||||||
;; what exacly is shift+altgr supposed to hold ?
|
;; what exacly is shift+altgr supposed to hold ?
|
||||||
(alternative 'shift-alt (lambda (c) (send k set-other-shift-altgr-key-code c)) shift-alt-mod)))
|
(alternative 'shift-alt (lambda (c) (send k set-other-shift-altgr-key-code c)) shift-alt-mod)))
|
||||||
|
|
||||||
;; TODO What was this swapping meant to do?
|
;; If the Option key is disabled globally via
|
||||||
#;(when (and (or (and option?
|
;; `special-option-key`, then swap the Option and
|
||||||
special-option-key?)
|
;; non-Option results when Option is pressed.
|
||||||
(and control?
|
(when (and option?
|
||||||
(equal? (send k get-key-code) #\u00)))
|
special-option-key?
|
||||||
(send k get-other-altgr-key-code))
|
(send k get-other-altgr-key-code))
|
||||||
;; swap altenate with main
|
|
||||||
(let ([other (send k get-other-altgr-key-code)])
|
(let ([other (send k get-other-altgr-key-code)])
|
||||||
(send k set-other-altgr-key-code (send k get-key-code))
|
(send k set-other-altgr-key-code (send k get-key-code))
|
||||||
(send k set-key-code other))))
|
(send k set-key-code other)))
|
||||||
|
;; When a Ctl- combination produces
|
||||||
|
;; no key (such as with Ctl-space), it works ok to
|
||||||
|
;; use the mapping produced with Shift also down.
|
||||||
|
(when (and control?
|
||||||
|
(equal? (send k get-key-code) #\u00)
|
||||||
|
(send k get-other-shift-key-code))
|
||||||
|
(send k set-key-code (send k get-other-shift-key-code))))
|
||||||
(unless wheel
|
(unless wheel
|
||||||
(unless (or down? (and mod-change?
|
(unless (or down? (and mod-change?
|
||||||
(case (send k get-key-code)
|
(case (send k get-key-code)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user