dont starve events when gui active

This commit is contained in:
Jay McCarthy 2015-04-10 19:04:21 -04:00
parent a47b06afa1
commit 8561328213
1 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,10 @@
racket/async-channel racket/async-channel
lux/chaos) lux/chaos)
;; Robby says that I could rework this to remove the event-ch by
;; having capturing the continuation, storing it, and then calling it
;; from within the callback once an event is ready.
(struct gui (event-ch drawer frame refresh!) (struct gui (event-ch drawer frame refresh!)
#:methods gen:chaos #:methods gen:chaos
[(define (chaos-yield c e) [(define (chaos-yield c e)
@ -72,8 +76,14 @@
[style [style
(cons 'no-autoclear (cons 'no-autoclear
(if gl-config '(gl) '()))])) (if gl-config '(gl) '()))]))
(define the-refresh-sema (make-semaphore 0))
(define (refresh!) (define (refresh!)
(send c refresh-now)) (queue-callback
(λ ()
(send c refresh-now)
(semaphore-post the-refresh-sema))
#f)
(yield the-refresh-sema))
(send f center) (send f center)
(send f show #t) (send f show #t)