cocoa: try to fix problem with drifting gc-blit window

original commit: 510c3f8a3362fe67979e805910b90c5bd440f586
This commit is contained in:
Matthew Flatt 2010-11-23 10:02:45 -07:00
parent 9fa0057c3b
commit 93b21b51b1
5 changed files with 25 additions and 2 deletions

View File

@ -404,6 +404,11 @@
(super show-children) (super show-children)
(resume-all-reg-blits)) (resume-all-reg-blits))
(define/override (fixup-locations-children)
;; in atomic mode
(suspend-all-reg-blits)
(resume-all-reg-blits))
(define/private (do-set-size x y w h) (define/private (do-set-size x y w h)
(when (pair? blits) (when (pair? blits)
(atomically (suspend-all-reg-blits))) (atomically (suspend-all-reg-blits)))

View File

@ -319,6 +319,9 @@
(define/override (show-children) (define/override (show-children)
(when saved-child (when saved-child
(send saved-child show-children))) (send saved-child show-children)))
(define/override (fixup-locations-children)
(when saved-child
(send saved-child fixup-locations-children)))
(define/override (children-accept-drag on?) (define/override (children-accept-drag on?)
(when saved-child (when saved-child
@ -532,3 +535,8 @@
(make-NSPoint x (- (NSSize-height (NSRect-size f)) y))) (make-NSPoint x (- (NSSize-height (NSRect-size f)) y)))
belowWindowWithWindowNumber: #:type _NSInteger 0)]) belowWindowWithWindowNumber: #:type _NSInteger 0)])
(atomically (hash-ref all-windows n #f)))) (atomically (hash-ref all-windows n #f))))
(set-fixup-window-locations!
(lambda ()
(for ([f (in-hash-values all-windows)])
(send f fixup-locations-children))))

View File

@ -41,6 +41,10 @@
(for ([child (in-list children)]) (for ([child (in-list children)])
(send child show-children))) (send child show-children)))
(define/override (fixup-locations-children)
(for ([child (in-list children)])
(send child fixup-locations-children)))
(define/override (paint-children) (define/override (paint-children)
(for ([child (in-list children)]) (for ([child (in-list children)])
(send child paint-children))) (send child paint-children)))

View File

@ -19,6 +19,7 @@
set-eventspace-hook! set-eventspace-hook!
set-front-hook! set-front-hook!
set-menu-bar-hooks! set-menu-bar-hooks!
set-fixup-window-locations!
post-dummy-event post-dummy-event
try-to-sync-refresh) try-to-sync-refresh)
@ -58,8 +59,11 @@
(let ([priviledged-custodian ((get-ffi-obj 'scheme_make_custodian #f (_fun _pointer -> _scheme)) #f)]) (let ([priviledged-custodian ((get-ffi-obj 'scheme_make_custodian #f (_fun _pointer -> _scheme)) #f)])
(parameterize ([current-custodian priviledged-custodian]) (parameterize ([current-custodian priviledged-custodian])
(thread (lambda () (sleep 5.0))))) (thread (lambda () (sleep 5.0)))))
;; FIXME: Also need to reset blit windows, since OS may move them incorrectly ;; Also need to reset blit windows, since OS may move them incorrectly:
(void)]) (fixup-window-locations)])
(define fixup-window-locations void)
(define (set-fixup-window-locations! f) (set! fixup-window-locations f))
;; In case we were started in an executable without a bundle, ;; In case we were started in an executable without a bundle,
;; explicitly register with the dock so the application can receive ;; explicitly register with the dock so the application can receive

View File

@ -379,6 +379,8 @@
(focus-is-on #f)) (focus-is-on #f))
(define/public (show-children) (define/public (show-children)
(void)) (void))
(define/public (fixup-locations-children)
(void))
(define/public (fix-dc) (define/public (fix-dc)
(void)) (void))
(define/public (paint-children) (define/public (paint-children)