canvas and frame repairs

This commit is contained in:
Matthew Flatt 2010-07-25 12:05:01 -05:00
parent 238650e327
commit ac6139345d
2 changed files with 17 additions and 9 deletions

View File

@ -79,6 +79,8 @@
(define canvas-style style) (define canvas-style style)
(define is-visible? #f)
;; Avoid multiple queued paints: ;; Avoid multiple queued paints:
(define paint-queued? #f) (define paint-queued? #f)
;; To handle paint requests that happen while on-paint ;; To handle paint requests that happen while on-paint
@ -92,13 +94,14 @@
(set! paint-queued? #t) (set! paint-queued? #t)
(queue-window-event this (lambda () (queue-window-event this (lambda ()
(set! paint-queued? #f) (set! paint-queued? #f)
(when is-visible?
(set! now-drawing? #t) (set! now-drawing? #t)
(fix-dc) (fix-dc)
(on-paint) (on-paint)
(set! now-drawing? #f) (set! now-drawing? #f)
(when refresh-after-drawing? (when refresh-after-drawing?
(set! refresh-after-drawing? #f) (set! refresh-after-drawing? #f)
(refresh)))))) (refresh)))))))
(define/override (refresh) (define/override (refresh)
(tellv content-cocoa setNeedsDisplay: #:type _BOOL #t)) (tellv content-cocoa setNeedsDisplay: #:type _BOOL #t))
@ -148,6 +151,11 @@
(define tr 0) (define tr 0)
(define/override (show on?)
(set! is-visible? on?)
;; FIXME: what if we're in the middle of an on-paint?
(super show on?))
(define/private (do-set-size x y w h) (define/private (do-set-size x y w h)
(super set-size x y w h) (super set-size x y w h)
(when tr (when tr

View File

@ -128,11 +128,11 @@
[fh (unbox h-box)]) [fh (unbox h-box)])
(set-top-position (if (or (eq? dir 'both) (set-top-position (if (or (eq? dir 'both)
(eq? dir 'horizontal)) (eq? dir 'horizontal))
(/ (- sw fw) 2) (quotient (- sw fw) 2)
-11111) -11111)
(if (or (eq? dir 'both) (if (or (eq? dir 'both)
(eq? dir 'vertical)) (eq? dir 'vertical))
(/ (- sh fh) 2) (quotient (- sh fh) 2)
-11111))))) -11111)))))
(define/override (set-top-position x y) (define/override (set-top-position x y)