racket/gui: fixups for mod3-5 event additions
Move new initialization arguments to the end to avoid backward incompatibility, add fields to `module-event%`, and include history notes in the documentation.
This commit is contained in:
parent
e7f0f3587a
commit
be58be349a
|
@ -20,24 +20,26 @@ See also @|mousekeydiscuss|.
|
|||
[shift-down any/c #f]
|
||||
[control-down any/c #f]
|
||||
[meta-down any/c #f]
|
||||
[mod3-down any/c #f]
|
||||
[mod4-down any/c #f]
|
||||
[mod5-down any/c #f]
|
||||
[alt-down any/c #f]
|
||||
[x exact-integer? 0]
|
||||
[y exact-integer? 0]
|
||||
[time-stamp exact-integer? 0]
|
||||
[caps-down any/c #f])]{
|
||||
[caps-down any/c #f]
|
||||
[mod3-down any/c #f]
|
||||
[mod4-down any/c #f]
|
||||
[mod5-down any/c #f])]{
|
||||
|
||||
See the corresponding @racketidfont{get-} and @racketidfont{set-}
|
||||
methods for information about @racket[key-code], @racket[shift-down],
|
||||
@racket[control-down], @racket[meta-down], @racket[mod3-down], @racket[mod4-down],
|
||||
@racket[mod5-down], @racket[alt-down], @racket[x], @racket[y],
|
||||
@racket[time-stamp], @racket[caps-down].
|
||||
@racket[time-stamp], @racket[caps-down], @racket[mod3-down],
|
||||
@racket[mod4-down], and @racket[mod5-down].
|
||||
|
||||
The release key code, as returned by @method[key-event%
|
||||
get-key-release-code], is initialized to @racket['press].
|
||||
|
||||
@history[#:changed "1.1" @elem{Added @racket[mod3-down], @racket[mod4-down], and @racket[mod5-down].}]
|
||||
}
|
||||
|
||||
@defmethod[(get-alt-down)
|
||||
|
@ -214,21 +216,21 @@ Returns @racket[#t] if the Meta (Unix), Alt (Windows), or Command (Mac OS
|
|||
|
||||
Returns @racket[#t] if the Mod3 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-mod4-down)
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the Mod4 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-mod5-down)
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the Mod5 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-other-altgr-key-code)
|
||||
(or/c char? key-code-symbol? #f)]{
|
||||
|
@ -369,21 +371,21 @@ Sets whether the Meta (Unix), Alt (Windows), or Command (Mac OS X) key
|
|||
|
||||
Sets whether the Mod3 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-mod4-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
Sets whether the Mod4 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-mod5-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
Sets whether the Mod5 (Unix) key was down for the event.
|
||||
|
||||
}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-other-altgr-key-code [code (or/c char? key-code-symbol? #f)])
|
||||
void?]{
|
||||
|
|
|
@ -26,7 +26,10 @@ See also @|mousekeydiscuss|.
|
|||
[meta-down any/c #f]
|
||||
[alt-down any/c #f]
|
||||
[time-stamp exact-integer? 0]
|
||||
[caps-down any/c #f])]{
|
||||
[caps-down any/c #f]
|
||||
[mod3-down any/c #f]
|
||||
[mod4-down any/c #f]
|
||||
[mod5-down any/c #f])]{
|
||||
|
||||
Creates a mouse event for a particular type of event. The event types
|
||||
are:
|
||||
|
@ -47,8 +50,10 @@ See the corresponding @racketidfont{get-} and @racketidfont{set-}
|
|||
methods for information about @racket[left-down],
|
||||
@racket[middle-down], @racket[right-down], @racket[x], @racket[y],
|
||||
@racket[shift-down], @racket[control-down], @racket[meta-down],
|
||||
@racket[alt-down], @racket[time-stamp], and @racket[caps-down].
|
||||
@racket[alt-down], @racket[time-stamp], @racket[caps-down], @racket[mod3-down],
|
||||
@racket[mod4-down], and @racket[mod5-down].
|
||||
|
||||
@history[#:changed "1.1" @elem{Added @racket[mod3-down], @racket[mod4-down], and @racket[mod5-down].}]
|
||||
}
|
||||
|
||||
@defmethod[(button-changed? [button (or/c 'left 'middle 'right 'any) 'any])
|
||||
|
@ -175,6 +180,27 @@ Returns @racket[#t] if the middle mouse button was down (but not
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(get-mod3-down)
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the Mod3 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-mod4-down)
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the Mod4 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-mod5-down)
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the Mod5 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(get-right-down)
|
||||
boolean?]{
|
||||
|
||||
|
@ -288,6 +314,27 @@ Sets whether the middle mouse button was down (but not pressed) for
|
|||
|
||||
}
|
||||
|
||||
@defmethod[(set-mod3-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
Sets whether the Mod3 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-mod4-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
Sets whether the Mod4 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-mod5-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
Sets whether the Mod5 (Unix) key was down for the event.
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@defmethod[(set-right-down [down? any/c])
|
||||
void?]{
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@
|
|||
[[bool? meta-down] #f]
|
||||
[[bool? alt-down] #f])
|
||||
(init [time-stamp 0])
|
||||
(init-properties [[bool? caps-down] #f])
|
||||
(init-properties [[bool? caps-down] #f]
|
||||
[[bool? mod3-down] #f]
|
||||
[[bool? mod4-down] #f]
|
||||
[[bool? mod5-down] #f])
|
||||
(super-new [time-stamp time-stamp])
|
||||
|
||||
(def/public (button-changed? [(symbol-in left middle right any) [button 'any]])
|
||||
|
@ -77,14 +80,14 @@
|
|||
[[bool? shift-down] #f]
|
||||
[[bool? control-down] #f]
|
||||
[[bool? meta-down] #f]
|
||||
[[bool? mod3-down] #f]
|
||||
[[bool? mod4-down] #f]
|
||||
[[bool? mod5-down] #f]
|
||||
[[bool? alt-down] #f]
|
||||
[[exact-integer? x] 0]
|
||||
[[exact-integer? y] 0])
|
||||
(init [time-stamp 0])
|
||||
(init-properties [[bool? caps-down] #f])
|
||||
(init-properties [[bool? caps-down] #f]
|
||||
[[bool? mod3-down] #f]
|
||||
[[bool? mod4-down] #f]
|
||||
[[bool? mod5-down] #f])
|
||||
(properties [[(make-alts symbol? char?) key-release-code] 'press]
|
||||
[[(make-or-false (make-alts symbol? char?)) other-shift-key-code] #f]
|
||||
[[(make-or-false (make-alts symbol? char?)) other-altgr-key-code] #f]
|
||||
|
|
|
@ -395,6 +395,9 @@
|
|||
[control-down (bit? modifiers GDK_CONTROL_MASK)]
|
||||
[meta-down (bit? modifiers GDK_META_MASK)]
|
||||
[alt-down (bit? modifiers GDK_MOD1_MASK)]
|
||||
[mod3-down (bit? modifiers GDK_MOD3_MASK)]
|
||||
[mod4-down (bit? modifiers GDK_MOD4_MASK)]
|
||||
[mod5-down (bit? modifiers GDK_MOD5_MASK)]
|
||||
[time-stamp ((if motion? GdkEventMotion-time
|
||||
(if crossing? GdkEventCrossing-time GdkEventButton-time))
|
||||
event)]
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
(class canvas%
|
||||
(super-new)
|
||||
(define/override (on-event ev)
|
||||
(printf "~a~a MOUSE ~a (~a,~a)\n mods:~a~a~a~a~a\n buttons:~a~a~a~a~a~a~a\n"
|
||||
(printf "~a~a MOUSE ~a (~a,~a)\n mods:~a~a~a~a~a~a~a~a\n buttons:~a~a~a~a~a~a~a\n"
|
||||
(es-check)
|
||||
iter
|
||||
(send ev get-event-type)
|
||||
|
@ -27,6 +27,9 @@
|
|||
(if (send ev get-alt-down) " ALT" "")
|
||||
(if (send ev get-shift-down) " SHIFT" "")
|
||||
(if (send ev get-caps-down) " CAPS" "")
|
||||
(if (send ev get-mod3-down) " MOD3" "")
|
||||
(if (send ev get-mod4-down) " MOD4" "")
|
||||
(if (send ev get-mod5-down) " MOD5" "")
|
||||
(if (send ev get-left-down) " LEFT" "")
|
||||
(if (send ev get-middle-down) " MIDDLE" "")
|
||||
(if (send ev get-right-down) " RIGHT" "")
|
||||
|
@ -44,7 +47,7 @@
|
|||
"")))
|
||||
(define/override (on-char ev)
|
||||
(set! iter (add1 iter))
|
||||
(printf "~a~a KEY: ~a\n rel-code: ~a\n other-codes: ~a\n mods:~a~a~a~a~a\n"
|
||||
(printf "~a~a KEY: ~a\n rel-code: ~a\n other-codes: ~a\n mods:~a~a~a~a~a~a~a~a\n"
|
||||
(es-check)
|
||||
iter
|
||||
(let ([v (send ev get-key-code)])
|
||||
|
@ -69,7 +72,10 @@
|
|||
(if (send ev get-control-down) " CTL" "")
|
||||
(if (send ev get-alt-down) " ALT" "")
|
||||
(if (send ev get-shift-down) " SHIFT" "")
|
||||
(if (send ev get-caps-down) " CAPS" "")))))
|
||||
(if (send ev get-caps-down) " CAPS" "")
|
||||
(if (send ev get-mod3-down) " MOD3" "")
|
||||
(if (send ev get-mod4-down) " MOD4" "")
|
||||
(if (send ev get-mod5-down) " MOD5" "")))))
|
||||
(define f (make-object (class frame%
|
||||
(inherit accept-drop-files)
|
||||
(define/override (on-drop-file file)
|
||||
|
|
|
@ -1112,4 +1112,65 @@
|
|||
(panel-tests frame% #f)
|
||||
(panel-tests dialog% 'dialog)
|
||||
|
||||
(let ([e (make-object mouse-event%
|
||||
'motion
|
||||
#t ; left
|
||||
#f ; middle
|
||||
#f ; right
|
||||
11 ; x
|
||||
33 ; y
|
||||
#t ; shift
|
||||
#f ; control
|
||||
#t ; meta
|
||||
#f ; alt
|
||||
13 ; timestamp
|
||||
#f ; caps
|
||||
#t ; mod3
|
||||
#f ; mod4
|
||||
#t ; mod5
|
||||
)])
|
||||
(st 'motion e get-event-type)
|
||||
(st #t e get-left-down)
|
||||
(st #f e get-middle-down)
|
||||
(st #f e get-right-down)
|
||||
(st 11 e get-x)
|
||||
(st 33 e get-y)
|
||||
(st #t e get-shift-down)
|
||||
(st #f e get-control-down)
|
||||
(st #t e get-meta-down)
|
||||
(st #f e get-alt-down)
|
||||
(st 13 e get-time-stamp)
|
||||
(st #f e get-caps-down)
|
||||
(st #t e get-mod3-down)
|
||||
(st #f e get-mod4-down)
|
||||
(st #t e get-mod5-down))
|
||||
|
||||
(let ([e (make-object key-event%
|
||||
#\x
|
||||
#t ; shift
|
||||
#f ; control
|
||||
#t ; meta
|
||||
#f ; alt
|
||||
11 ; x
|
||||
33 ; y
|
||||
13 ; timestamp
|
||||
#f ; caps
|
||||
#t ; mod3
|
||||
#f ; mod4
|
||||
#t ; mod5
|
||||
)])
|
||||
(st #\x e get-key-code)
|
||||
(st 'press e get-key-release-code)
|
||||
(st 11 e get-x)
|
||||
(st 33 e get-y)
|
||||
(st #t e get-shift-down)
|
||||
(st #f e get-control-down)
|
||||
(st #t e get-meta-down)
|
||||
(st #f e get-alt-down)
|
||||
(st 13 e get-time-stamp)
|
||||
(st #f e get-caps-down)
|
||||
(st #t e get-mod3-down)
|
||||
(st #f e get-mod4-down)
|
||||
(st #t e get-mod5-down))
|
||||
|
||||
(report-errs)
|
||||
|
|
Loading…
Reference in New Issue
Block a user