diff --git a/gui-doc/scribblings/gui/eventspace-funcs.scrbl b/gui-doc/scribblings/gui/eventspace-funcs.scrbl index 5326ade0..ab1f0d7e 100644 --- a/gui-doc/scribblings/gui/eventspace-funcs.scrbl +++ b/gui-doc/scribblings/gui/eventspace-funcs.scrbl @@ -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. diff --git a/gui-lib/mred/private/wx/cocoa/window.rkt b/gui-lib/mred/private/wx/cocoa/window.rkt index 8713b301..605ee3ed 100644 --- a/gui-lib/mred/private/wx/cocoa/window.rkt +++ b/gui-lib/mred/private/wx/cocoa/window.rkt @@ -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)