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)
|
||||
boolean?])]{
|
||||
|
||||
Enables or disables special Control key handling (Mac OS X). When Control
|
||||
is treated as a special key, the system's key-mapper is called
|
||||
without Control for keyboard translations. For some languages,
|
||||
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.
|
||||
For backward compatibility, only. This function was intended to enable
|
||||
or disable special Control key handling (Mac OS X), but it currently
|
||||
has no effect.
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,14 +110,15 @@ currently treated specially, @racket[#f] otherwise.
|
|||
void?]
|
||||
[(special-option-key)
|
||||
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
|
||||
system translation as normal. This setting affects all windows and
|
||||
eventspaces.
|
||||
Enables or disables special Option key handling (Mac OS X). When
|
||||
Option is treated as a special key, the @method[key-event%
|
||||
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
|
||||
currently treated specially, @racket[#f] otherwise.
|
||||
|
|
|
@ -413,17 +413,23 @@
|
|||
(alternative 'alt (lambda (c) (send k set-other-altgr-key-code c)) alt-mod)
|
||||
;; 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)))
|
||||
|
||||
;; TODO What was this swapping meant to do?
|
||||
#;(when (and (or (and option?
|
||||
special-option-key?)
|
||||
(and control?
|
||||
(equal? (send k get-key-code) #\u00)))
|
||||
|
||||
;; If the Option key is disabled globally via
|
||||
;; `special-option-key`, then swap the Option and
|
||||
;; non-Option results when Option is pressed.
|
||||
(when (and option?
|
||||
special-option-key?
|
||||
(send k get-other-altgr-key-code))
|
||||
;; swap altenate with main
|
||||
(let ([other (send k get-other-altgr-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 (or down? (and mod-change?
|
||||
(case (send k get-key-code)
|
||||
|
|
Loading…
Reference in New Issue
Block a user