cocoa: fix problems with no-frame root menu
on-demand callback and original installation original commit: 21ca120c8c496f222a71160c499df214efe46001
This commit is contained in:
parent
03e92ae833
commit
57cb03ba6e
|
@ -118,8 +118,11 @@
|
||||||
#:mixins (FocusResponder KeyMouseResponder MyWindowMethods)
|
#:mixins (FocusResponder KeyMouseResponder MyWindowMethods)
|
||||||
[wxb])
|
[wxb])
|
||||||
|
|
||||||
(set-front-hook! (lambda () (values front
|
(set-front-hook! (lambda ()
|
||||||
(and front (send front get-eventspace)))))
|
(let ([f (or front
|
||||||
|
root-fake-frame)])
|
||||||
|
(values f
|
||||||
|
(and f (send f get-eventspace))))))
|
||||||
|
|
||||||
(set-eventspace-hook! (lambda (w)
|
(set-eventspace-hook! (lambda (w)
|
||||||
(or (and w
|
(or (and w
|
||||||
|
@ -266,18 +269,7 @@
|
||||||
(tell (tell NSApplication sharedApplication)
|
(tell (tell NSApplication sharedApplication)
|
||||||
endSheet: cocoa))))
|
endSheet: cocoa))))
|
||||||
(tellv cocoa orderOut: #f)
|
(tellv cocoa orderOut: #f)
|
||||||
(let ([next
|
(let ([next (get-app-front-window)])
|
||||||
(atomically
|
|
||||||
(with-autorelease
|
|
||||||
(let ([wins (tell (tell NSApplication sharedApplication) orderedWindows)])
|
|
||||||
(begin0
|
|
||||||
(for/or ([i (in-range (tell #:type _NSUInteger wins count))])
|
|
||||||
(let ([win (tell wins objectAtIndex: #:type _NSUInteger i)])
|
|
||||||
(and (tell #:type _BOOL win isVisible)
|
|
||||||
(not (tell win parentWindow))
|
|
||||||
(or (not root-fake-frame)
|
|
||||||
(not (ptr-equal? win (send root-fake-frame get-cocoa))))
|
|
||||||
win)))))))])
|
|
||||||
(cond
|
(cond
|
||||||
[next (tellv next makeKeyWindow)]
|
[next (tellv next makeKeyWindow)]
|
||||||
[root-fake-frame (send root-fake-frame install-mb)]
|
[root-fake-frame (send root-fake-frame install-mb)]
|
||||||
|
@ -483,7 +475,9 @@
|
||||||
(define/public (set-menu-bar _mb)
|
(define/public (set-menu-bar _mb)
|
||||||
(set! mb _mb)
|
(set! mb _mb)
|
||||||
(send mb set-top-window this)
|
(send mb set-top-window this)
|
||||||
(when (tell #:type _BOOL cocoa isMainWindow)
|
(when (or (tell #:type _BOOL cocoa isMainWindow)
|
||||||
|
(and (eq? this root-fake-frame)
|
||||||
|
(not (get-app-front-window))))
|
||||||
(install-mb)))
|
(install-mb)))
|
||||||
|
|
||||||
(define/public (install-mb)
|
(define/public (install-mb)
|
||||||
|
@ -541,6 +535,19 @@
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
|
(define (get-app-front-window)
|
||||||
|
(atomically
|
||||||
|
(with-autorelease
|
||||||
|
(let ([wins (tell (tell NSApplication sharedApplication) orderedWindows)])
|
||||||
|
(begin0
|
||||||
|
(for/or ([i (in-range (tell #:type _NSUInteger wins count))])
|
||||||
|
(let ([win (tell wins objectAtIndex: #:type _NSUInteger i)])
|
||||||
|
(and (tell #:type _BOOL win isVisible)
|
||||||
|
(not (tell win parentWindow))
|
||||||
|
(or (not root-fake-frame)
|
||||||
|
(not (ptr-equal? win (send root-fake-frame get-cocoa))))
|
||||||
|
win))))))))
|
||||||
|
|
||||||
(define (location->window x y)
|
(define (location->window x y)
|
||||||
(let ([n (tell #:type _NSInteger NSWindow
|
(let ([n (tell #:type _NSInteger NSWindow
|
||||||
windowNumberAtPoint: #:type _NSPoint
|
windowNumberAtPoint: #:type _NSPoint
|
||||||
|
|
Loading…
Reference in New Issue
Block a user