adjust the fields of the gui-event struct
original commit: 33eba697a0d1fe354768dd8d7c77bacbe9b7ab14
This commit is contained in:
parent
894d5a5fb6
commit
0cea8f0684
|
@ -442,7 +442,7 @@
|
||||||
;; start? : boolean -- indicates if this is a start of an event being handled or not
|
;; start? : boolean -- indicates if this is a start of an event being handled or not
|
||||||
;; msec : start time if start? is #t, delta from start to end if start? is #f
|
;; msec : start time if start? is #t, delta from start to end if start? is #f
|
||||||
;; name : (or/c #f symbol?)
|
;; name : (or/c #f symbol?)
|
||||||
(struct gui-event (start? msec name) #:prefab)
|
(struct gui-event (start end name) #:prefab)
|
||||||
|
|
||||||
(define (handle-event thunk e)
|
(define (handle-event thunk e)
|
||||||
(call-with-continuation-prompt ; to delimit continuations
|
(call-with-continuation-prompt ; to delimit continuations
|
||||||
|
@ -454,7 +454,7 @@
|
||||||
(when (log-level? event-logger 'debug)
|
(when (log-level? event-logger 'debug)
|
||||||
(log-message event-logger 'debug
|
(log-message event-logger 'debug
|
||||||
"starting to handle an event"
|
"starting to handle an event"
|
||||||
(gui-event #t before (object-name thunk))))
|
(gui-event before #f (object-name thunk))))
|
||||||
(let ([b (box thunk)])
|
(let ([b (box thunk)])
|
||||||
;; use the event-dispatch handler:
|
;; use the event-dispatch handler:
|
||||||
(with-continuation-mark dispatch-event-key b
|
(with-continuation-mark dispatch-event-key b
|
||||||
|
@ -469,7 +469,7 @@
|
||||||
(log-message event-logger 'debug
|
(log-message event-logger 'debug
|
||||||
(format "handled an event: ~a msec"
|
(format "handled an event: ~a msec"
|
||||||
(- after before))
|
(- after before))
|
||||||
(gui-event #f (- after before) (object-name thunk)))))
|
(gui-event before after (object-name thunk)))))
|
||||||
dispatch-event-prompt))))
|
dispatch-event-prompt))))
|
||||||
|
|
||||||
(define yield
|
(define yield
|
||||||
|
|
|
@ -957,15 +957,13 @@ The GUI system logs the timing of when events are handled and how
|
||||||
long they take to be handled. Each event that involves a callback
|
long they take to be handled. Each event that involves a callback
|
||||||
into Racket code has two events logged, both of which use
|
into Racket code has two events logged, both of which use
|
||||||
the @racket[gui-event] struct:
|
the @racket[gui-event] struct:
|
||||||
@racketblock[(struct gui-event (start? msec name) #:prefab)]
|
@racketblock[(struct gui-event (start end name) #:prefab)]
|
||||||
The @racket[start?] field is a boolean indicating if this
|
The @racket[_start] field is the result of @racket[(current-inexact-milliseconds)]
|
||||||
event is logging the time when an event is starting to be handled,
|
when the event handling starts. The @racket[_end] field is
|
||||||
or when it finishes. In the case that @racket[start?] is @racket[#t],
|
@racket[#f] for the log message when the event handling starts,
|
||||||
the @racket[msec] field is the result of
|
and the result of @racket[(current-inexact-milliseconds)] when
|
||||||
@racket[current-inexact-milliseconds]; when @racket[start?] is @racket[#f],
|
it finishes for the log message when an event finishes.
|
||||||
then the @racket[msec] field is the number of milliseconds that the
|
The @racket[_name] field is
|
||||||
event handling took (the difference between @racket[current-inexact-milliseconds]'s
|
|
||||||
results before and after the handling). The @racket[name] field is
|
|
||||||
the name of the function that handled the event; in the case of a
|
the name of the function that handled the event; in the case of a
|
||||||
@racket[queue-callback]-based event, it is the name of the thunk passed to
|
@racket[queue-callback]-based event, it is the name of the thunk passed to
|
||||||
@racket[queue-callback].
|
@racket[queue-callback].
|
||||||
|
|
Loading…
Reference in New Issue
Block a user