racket/gui: fix reporting of numpad Enter as 'numpad-enter
On Unix and Mac OS X, the key has long been reported as #\u3, even though the documentation says 'numpad-enter. A more compatible change would be to adjust the documentation and also change DrRacket and the framework to recognize #\u3 instead of 'numpad-enter. But there doesn't seem to be a good reason to treat #\u3 as "numpad Enter" --- particularly as opposed to treating it as "Ctl-C" --- other than ancient Mac history. On Windows, numpad Enter continues to be reported as #\return, since Windows event handling doesn't naturally or easily distinguish the two keys. original commit: 7d388a0795cd42e12e0ff3431d744c0bb89ac37b
This commit is contained in:
parent
84fb22abaf
commit
ab2729be09
|
@ -175,8 +175,7 @@ The special key symbols attempt to capture useful keys that have no
|
||||||
|
|
||||||
@item{@racket[#\return] --- the Enter or Return key (on all
|
@item{@racket[#\return] --- the Enter or Return key (on all
|
||||||
platforms), but not necessarily the Enter key near the numpad
|
platforms), but not necessarily the Enter key near the numpad
|
||||||
(which is reported as @racket['numpad-enter] if the platform
|
(which is reported as @racket['numpad-enter] Unix and Mac OS X)}
|
||||||
distinguishes the two Enter keys)}
|
|
||||||
|
|
||||||
@item{@racket[#\tab] --- the tab key}
|
@item{@racket[#\tab] --- the tab key}
|
||||||
|
|
||||||
|
@ -206,7 +205,11 @@ On Windows, when the Control key is pressed without Alt, the key
|
||||||
|
|
||||||
See also @method[key-event% get-other-shift-key-code].
|
See also @method[key-event% get-other-shift-key-code].
|
||||||
|
|
||||||
}
|
@history[#:changed "6.1.0.8" @elem{Changed reporting of numpad Enter
|
||||||
|
to @racket['numpad-enter] as
|
||||||
|
documented, instead of
|
||||||
|
@racket[#\u03].}]}
|
||||||
|
|
||||||
|
|
||||||
@defmethod[(get-key-release-code)
|
@defmethod[(get-key-release-code)
|
||||||
(or/c char? key-code-symbol?)]{
|
(or/c char? key-code-symbol?)]{
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
(override*
|
(override*
|
||||||
[on-char (lambda (c)
|
[on-char (lambda (c)
|
||||||
(super-on-char c)
|
(super-on-char c)
|
||||||
(when (and (memq (send c get-key-code) '(#\return #\newline #\003))
|
(when (and (memq (send c get-key-code) '(#\return #\newline numpad-enter))
|
||||||
(not locked?))
|
(not locked?))
|
||||||
(set! locked? #t)
|
(set! locked? #t)
|
||||||
(evaluate (get-text prompt-pos (last-position)))))])
|
(evaluate (get-text prompt-pos (last-position)))))])
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(#x4b . divide)
|
(#x4b . divide)
|
||||||
(71 . separator)
|
(71 . separator)
|
||||||
(65 . decimal)
|
(65 . decimal)
|
||||||
(76 . #\u3) ; numpad enter
|
(76 . numpad-enter) ; was #\u3 in earlier versions
|
||||||
(82 . numpad0)
|
(82 . numpad0)
|
||||||
(83 . numpad1)
|
(83 . numpad1)
|
||||||
(84 . numpad2)
|
(84 . numpad2)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
(#xff63 . insert)
|
(#xff63 . insert)
|
||||||
(#xff80 . #\space) ; keypad
|
(#xff80 . #\space) ; keypad
|
||||||
(#xff89 . #\tab) ; keypad
|
(#xff89 . #\tab) ; keypad
|
||||||
(#xff8d . #\u3) ; enter
|
(#xff8d . numpad-enter) ; was #\u3 in earlier versions
|
||||||
(#xff91 . f1)
|
(#xff91 . f1)
|
||||||
(#xff92 . f2)
|
(#xff92 . f2)
|
||||||
(#xff93 . f3)
|
(#xff93 . f3)
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
("numpad7" . numpad7)
|
("numpad7" . numpad7)
|
||||||
("numpad8" . numpad8)
|
("numpad8" . numpad8)
|
||||||
("numpad9" . numpad9)
|
("numpad9" . numpad9)
|
||||||
("numpadenter" . #\u3)
|
("numpadenter" . numpad-enter)
|
||||||
("f1" . f1)
|
("f1" . f1)
|
||||||
("f2" . f2)
|
("f2" . f2)
|
||||||
("f3" . f3)
|
("f3" . f3)
|
||||||
|
|
|
@ -629,7 +629,7 @@
|
||||||
[(add) (ins #\+)]
|
[(add) (ins #\+)]
|
||||||
[(subtract) (ins #\-)]
|
[(subtract) (ins #\-)]
|
||||||
[(decimal) (ins #\.)]
|
[(decimal) (ins #\.)]
|
||||||
[(#\u3) (ins #\return)] ; NUMPAD-ENTER
|
[(numpad-enter) (ins #\return)]
|
||||||
[(#\return #\tab) (ins code)]
|
[(#\return #\tab) (ins code)]
|
||||||
[else
|
[else
|
||||||
(let ([vcode (if (char? code)
|
(let ([vcode (if (char? code)
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
(let ([c (send e get-key-code)])
|
(let ([c (send e get-key-code)])
|
||||||
(unless (and (or (eq? c #\return)
|
(unless (and (or (eq? c #\return)
|
||||||
(eq? c #\newline)
|
(eq? c #\newline)
|
||||||
(eq? c #\u3)) ; numpad enter
|
(eq? c 'numpad-enter))
|
||||||
return-cb
|
return-cb
|
||||||
(return-cb (lambda () (callback 'text-field-enter) #t)))
|
(return-cb (lambda () (callback 'text-field-enter) #t)))
|
||||||
(as-exit (lambda () (super-on-char e)))))))]
|
(as-exit (lambda () (super-on-char e)))))))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user