cocoa: fix problems with frame-list management
This commit is contained in:
parent
0d6d285423
commit
14a72b5a08
|
@ -36,6 +36,9 @@
|
||||||
(define empty-mb (new menu-bar%))
|
(define empty-mb (new menu-bar%))
|
||||||
(define root-fake-frame #f)
|
(define root-fake-frame #f)
|
||||||
|
|
||||||
|
;; Maps window numbers to weak boxes of frame objects;
|
||||||
|
;; the weak-box layer is needed to avoid GC-accounting
|
||||||
|
;; problems.
|
||||||
(define all-windows (make-hash))
|
(define all-windows (make-hash))
|
||||||
|
|
||||||
(define-objc-mixin (MyWindowMethods Superclass)
|
(define-objc-mixin (MyWindowMethods Superclass)
|
||||||
|
@ -278,12 +281,12 @@
|
||||||
(register-frame-shown this on?)
|
(register-frame-shown this on?)
|
||||||
(let ([num (tell #:type _NSInteger cocoa windowNumber)])
|
(let ([num (tell #:type _NSInteger cocoa windowNumber)])
|
||||||
(if on?
|
(if on?
|
||||||
(hash-set! all-windows num this)
|
(hash-set! all-windows num (make-weak-box this))
|
||||||
(hash-remove! all-windows num)))
|
(hash-remove! all-windows num)))
|
||||||
(when on?
|
(when on?
|
||||||
(let ([b (eventspace-wait-cursor-count (get-eventspace))])
|
(let ([b (eventspace-wait-cursor-count (get-eventspace))])
|
||||||
(set-wait-cursor-mode (not (zero? b))))))
|
(set-wait-cursor-mode (not (zero? b))))))
|
||||||
|
|
||||||
(define/override (show on?)
|
(define/override (show on?)
|
||||||
(let ([es (get-eventspace)])
|
(let ([es (get-eventspace)])
|
||||||
(when on?
|
(when on?
|
||||||
|
@ -534,9 +537,13 @@
|
||||||
(let ([f (tell #:type _NSRect (tell NSScreen mainScreen) frame)])
|
(let ([f (tell #:type _NSRect (tell NSScreen mainScreen) frame)])
|
||||||
(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 (let ([b (hash-ref all-windows n #f)])
|
||||||
|
(and b (weak-box-value b))))))
|
||||||
|
|
||||||
(set-fixup-window-locations!
|
(set-fixup-window-locations!
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(for ([f (in-hash-values all-windows)])
|
;; in atomic mode
|
||||||
(send f fixup-locations-children))))
|
(for ([b (in-hash-values all-windows)])
|
||||||
|
(let ([f (weak-box-value b)])
|
||||||
|
(send f fixup-locations-children)))))
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
ffi/unsafe/objc
|
ffi/unsafe/objc
|
||||||
"../../lock.rkt"
|
"../../lock.rkt"
|
||||||
"dc.rkt"
|
"dc.rkt"
|
||||||
|
"frame.rkt"
|
||||||
"bitmap.rkt"
|
"bitmap.rkt"
|
||||||
"cg.rkt"
|
"cg.rkt"
|
||||||
"utils.rkt"
|
"utils.rkt"
|
||||||
|
@ -101,8 +102,13 @@
|
||||||
(send pss set-native pi make-print-info)
|
(send pss set-native pi make-print-info)
|
||||||
pi)))])
|
pi)))])
|
||||||
(install-pss-to-print-info pss print-info)
|
(install-pss-to-print-info pss print-info)
|
||||||
(if (= (tell #:type _NSInteger (tell NSPageLayout pageLayout) runModalWithPrintInfo: print-info)
|
(if (atomically
|
||||||
NSOkButton)
|
(let ([front (get-front)])
|
||||||
|
(begin0
|
||||||
|
(= (tell #:type _NSInteger (tell NSPageLayout pageLayout) runModalWithPrintInfo: print-info)
|
||||||
|
NSOkButton)
|
||||||
|
(when front
|
||||||
|
(tellv (send front get-cocoa-window) makeKeyAndOrderFront: #f)))))
|
||||||
(begin
|
(begin
|
||||||
(let ([o (tell #:type _int print-info orientation)])
|
(let ([o (tell #:type _int print-info orientation)])
|
||||||
(send pss set-orientation (if (= o NSLandscapeOrientation)
|
(send pss set-orientation (if (= o NSLandscapeOrientation)
|
||||||
|
@ -195,4 +201,8 @@
|
||||||
|
|
||||||
(set-ivar! view-cocoa wxb (->wxb this))
|
(set-ivar! view-cocoa wxb (->wxb this))
|
||||||
|
|
||||||
(tellv op-cocoa runOperation))))
|
(atomically
|
||||||
|
(let ([front (get-front)])
|
||||||
|
(tellv op-cocoa runOperation)
|
||||||
|
(when front
|
||||||
|
(tellv (send front get-cocoa-window) makeKeyAndOrderFront: #f)))))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user