more attempts to avoid flicker

This commit is contained in:
Matthew Flatt 2010-09-08 05:05:19 -06:00
parent 8c9e239798
commit f13b569b75
14 changed files with 35 additions and 32 deletions

View File

@ -248,6 +248,11 @@
(not (send dc can-backing-flush?)))
(do-on-paint #f #f)))
(define/public (begin-refresh-sequence)
(send dc suspend-flush))
(define/public (end-refresh-sequence)
(send dc resume-flush))
(define/override (refresh)
;; can be called from any thread, including the event-pump thread
(queue-paint))

View File

@ -57,6 +57,8 @@
(cairo_surface_destroy s)
(set! s #f)))))
(define-local-member-name end-delay)
(define dc%
(class backing-dc%
(init [(cnvs canvas)])
@ -94,10 +96,12 @@
(define/override (resume-flush)
(atomically
(set! suspend-count (sub1 suspend-count))
(when (and (zero? suspend-count) req)
(cancel-flush-delay req)
(set! req #f))
(super resume-flush)))))
(super resume-flush)))
(define/public (end-delay)
(when (and (zero? suspend-count) req)
(cancel-flush-delay req)
(set! req #f)))))
(define (do-backing-flush canvas dc ctx dx dy)
(tellv ctx saveGraphicsState)
@ -124,4 +128,5 @@
(cairo_set_source cr s)
(cairo_pattern_destroy s))
(cairo_destroy cr))))))
(tellv ctx restoreGraphicsState)))
(tellv ctx restoreGraphicsState)
(send dc end-delay)))

View File

@ -262,15 +262,20 @@
"the eventspace hash been shutdown"))
(when saved-child
(if (eq? (current-thread) (eventspace-handler-thread es))
(send saved-child paint-children)
(do-paint-children)
(let ([s (make-semaphore)])
(queue-callback (lambda ()
(when saved-child
(send saved-child paint-children))
(do-paint-children)
(semaphore-post s)))
(sync/timeout 0.2 s))))))
(sync/timeout 1 s))))))
(direct-show on?))
(define/private (do-paint-children)
(when saved-child
(send saved-child paint-children))
(yield-refresh)
(try-to-sync-refresh))
(define/public (destroy)
(when child-sheet (send child-sheet destroy))
(direct-show #f))

View File

@ -78,8 +78,6 @@
set-combo-box-font
get-double-click-time
run-printout
end-refresh-sequence
begin-refresh-sequence
file-creator-and-type
send-event
set-executer

View File

@ -30,8 +30,6 @@
set-executer
send-event
file-creator-and-type
begin-refresh-sequence
end-refresh-sequence
run-printout
get-double-click-time
set-combo-box-font

View File

@ -130,7 +130,7 @@
(super-tell #:type _void keyDown: event))]
[-a _void (keyUp: [_id event])
(unless (do-key-event wxb event self #f)
(super-tell #:type _void keyDown: event))]
(super-tell #:type _void keyUp: event))]
[-a _void (insertText: [_NSString str])
(let ([cit (current-insert-text)])
(if cit
@ -455,7 +455,10 @@
;; re-sync the display in case a stream of
;; events (e.g., key repeat) have a corersponding
;; stream of screen updates.
(void))
(try-to-sync-refresh)
(let ([cocoa-win (get-cocoa-window)])
(when cocoa-win
(tellv cocoa-win flushWindowIfNeeded))))
(define/public (dispatch-on-char/sync e)
(pre-event-refresh)

View File

@ -373,6 +373,9 @@
(define/public (on-paint) (void))
(define/public (begin-refresh-sequence) (void))
(define/public (end-refresh-sequence) (void))
(define/override (refresh)
(queue-paint))

View File

@ -78,8 +78,6 @@
set-combo-box-font
get-double-click-time
run-printout
end-refresh-sequence
begin-refresh-sequence
file-creator-and-type
send-event
set-executer

View File

@ -34,8 +34,6 @@
set-executer
send-event
file-creator-and-type
begin-refresh-sequence
end-refresh-sequence
run-printout
get-double-click-time
set-combo-box-font
@ -84,8 +82,6 @@
(case-lambda
[(path cr ty) (void)]
[(path) (values #"????" #"????")]))
(define (begin-refresh-sequence) (void))
(define (end-refresh-sequence) (void))
(define-unimplemented run-printout)
(define (get-double-click-time) 250)
(define (set-combo-box-font f) (void))

View File

@ -56,8 +56,6 @@
set-combo-box-font
get-double-click-time
run-printout
end-refresh-sequence
begin-refresh-sequence
file-creator-and-type
send-event
set-executer

View File

@ -77,8 +77,6 @@
set-combo-box-font
get-double-click-time
run-printout
end-refresh-sequence
begin-refresh-sequence
file-creator-and-type
send-event
set-executer

View File

@ -24,8 +24,6 @@
set-executer
send-event
file-creator-and-type
begin-refresh-sequence
end-refresh-sequence
run-printout
get-double-click-time
set-combo-box-font
@ -76,8 +74,6 @@
(define-unimplemented set-executer)
(define-unimplemented send-event)
(define-unimplemented file-creator-and-type)
(define-unimplemented begin-refresh-sequence)
(define-unimplemented end-refresh-sequence)
(define-unimplemented run-printout)
(define-unimplemented get-double-click-time)
(define-unimplemented set-combo-box-font)

View File

@ -159,7 +159,9 @@
get-scroll-range set-scroll-range
is-shown-to-root?
show-scrollbars
set-focus)
set-focus
begin-refresh-sequence
end-refresh-sequence)
(define blink-timer #f)
(define noloop? #f)

View File

@ -42,8 +42,6 @@
the-clipboard
the-x-selection-clipboard
get-double-click-threshold
begin-refresh-sequence
end-refresh-sequence
begin-busy-cursor
end-busy-cursor
hide-cursor