canvas and frame repairs

original commit: ac6139345d59448cb8d060a95bf9b0da43c58f69
This commit is contained in:
Matthew Flatt 2010-07-25 12:05:01 -05:00
parent 97fc56d722
commit 2e9088f07a
2 changed files with 17 additions and 9 deletions

View File

@ -79,6 +79,8 @@
(define canvas-style style)
(define is-visible? #f)
;; Avoid multiple queued paints:
(define paint-queued? #f)
;; To handle paint requests that happen while on-paint
@ -92,13 +94,14 @@
(set! paint-queued? #t)
(queue-window-event this (lambda ()
(set! paint-queued? #f)
(set! now-drawing? #t)
(fix-dc)
(on-paint)
(set! now-drawing? #f)
(when refresh-after-drawing?
(set! refresh-after-drawing? #f)
(refresh))))))
(when is-visible?
(set! now-drawing? #t)
(fix-dc)
(on-paint)
(set! now-drawing? #f)
(when refresh-after-drawing?
(set! refresh-after-drawing? #f)
(refresh)))))))
(define/override (refresh)
(tellv content-cocoa setNeedsDisplay: #:type _BOOL #t))
@ -148,6 +151,11 @@
(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)
(super set-size x y w h)
(when tr

View File

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