cocoa: avoid infinite loop on re-dispatch of command keys
This commit is contained in:
parent
d95e6f35c1
commit
e627ccb5ed
|
@ -35,6 +35,7 @@
|
|||
"MrEd"))
|
||||
|
||||
(define the-apple-menu #f)
|
||||
(define recurring-for-command (make-parameter #f))
|
||||
|
||||
(define-objc-class MyBarMenu NSMenu
|
||||
[]
|
||||
|
@ -44,13 +45,16 @@
|
|||
(or (and the-apple-menu
|
||||
(tell #:type _BOOL the-apple-menu performKeyEquivalent: evt))
|
||||
;; Explicity send the event to the keyWindow:
|
||||
(let ([w (tell app keyWindow)])
|
||||
(and w
|
||||
(let ([r (tell w firstResponder)])
|
||||
(and r
|
||||
(begin
|
||||
(tell r keyDown: evt)
|
||||
#t))))))))
|
||||
(and
|
||||
(not (recurring-for-command))
|
||||
(let ([w (tell app keyWindow)])
|
||||
(and w
|
||||
(let ([r (tell w firstResponder)])
|
||||
(and r
|
||||
(begin
|
||||
(parameterize ([recurring-for-command #t])
|
||||
(tell r keyDown: evt))
|
||||
#t)))))))))
|
||||
|
||||
(define cocoa-mb (tell (tell MyBarMenu alloc) init))
|
||||
(define current-mb #f)
|
||||
|
|
Loading…
Reference in New Issue
Block a user