adjust the fields of the gui-event struct

original commit: 33eba697a0d1fe354768dd8d7c77bacbe9b7ab14
This commit is contained in:
Robby Findler 2012-10-29 06:43:24 -05:00
parent 894d5a5fb6
commit 0cea8f0684
2 changed files with 10 additions and 12 deletions

View File

@ -442,7 +442,7 @@
;; 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
;; name : (or/c #f symbol?)
(struct gui-event (start? msec name) #:prefab)
(struct gui-event (start end name) #:prefab)
(define (handle-event thunk e)
(call-with-continuation-prompt ; to delimit continuations
@ -454,7 +454,7 @@
(when (log-level? event-logger 'debug)
(log-message event-logger 'debug
"starting to handle an event"
(gui-event #t before (object-name thunk))))
(gui-event before #f (object-name thunk))))
(let ([b (box thunk)])
;; use the event-dispatch handler:
(with-continuation-mark dispatch-event-key b
@ -469,7 +469,7 @@
(log-message event-logger 'debug
(format "handled an event: ~a msec"
(- after before))
(gui-event #f (- after before) (object-name thunk)))))
(gui-event before after (object-name thunk)))))
dispatch-event-prompt))))
(define yield

View File

@ -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
into Racket code has two events logged, both of which use
the @racket[gui-event] struct:
@racketblock[(struct gui-event (start? msec name) #:prefab)]
The @racket[start?] field is a boolean indicating if this
event is logging the time when an event is starting to be handled,
or when it finishes. In the case that @racket[start?] is @racket[#t],
the @racket[msec] field is the result of
@racket[current-inexact-milliseconds]; when @racket[start?] is @racket[#f],
then the @racket[msec] field is the number of milliseconds that the
event handling took (the difference between @racket[current-inexact-milliseconds]'s
results before and after the handling). The @racket[name] field is
@racketblock[(struct gui-event (start end name) #:prefab)]
The @racket[_start] field is the result of @racket[(current-inexact-milliseconds)]
when the event handling starts. The @racket[_end] field is
@racket[#f] for the log message when the event handling starts,
and the result of @racket[(current-inexact-milliseconds)] when
it finishes for the log message when an event finishes.
The @racket[_name] field is
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].