cocoa: fix application about handler
Closes PR 12165 original commit: 34eb5ec9832660fdc2960e4aba00f2c407fddf5e
This commit is contained in:
parent
c6a9b05793
commit
a08a642aa5
|
@ -108,7 +108,7 @@
|
|||
app))
|
||||
(tellv apple addItem: item)
|
||||
(tellv item release)))])
|
||||
(std (format "About ~a" app-name) (selector orderFrontStandardAboutPanel:))
|
||||
(std (format "About ~a" app-name) (selector openAbout:) "" #f #t)
|
||||
(std "Preferences..." (selector openPreferences:) "," #f #t)
|
||||
(tellv apple addItem: (tell NSMenuItem separatorItem))
|
||||
(let ([services (tell (tell NSMenu alloc) initWithTitle: #:type _NSString "Services")])
|
||||
|
|
|
@ -56,10 +56,21 @@
|
|||
(queue-prefs-event)
|
||||
#t]
|
||||
[-a _BOOL (validateMenuItem: [_id menuItem])
|
||||
(if (ptr-equal? (selector openPreferences:)
|
||||
(tell #:type _SEL menuItem action))
|
||||
(not (eq? (application-pref-handler) nothing-application-pref-handler))
|
||||
(super-tell #:type _BOOL validateMenuItem: menuItem))]
|
||||
(cond
|
||||
[(ptr-equal? (selector openPreferences:)
|
||||
(tell #:type _SEL menuItem action))
|
||||
(not (eq? (application-pref-handler) nothing-application-pref-handler))]
|
||||
[(ptr-equal? (selector openAbout:)
|
||||
(tell #:type _SEL menuItem action))
|
||||
#t]
|
||||
[else
|
||||
(super-tell #:type _BOOL validateMenuItem: menuItem)])]
|
||||
[-a _BOOL (openAbout: [_id sender])
|
||||
(if (eq? nothing-application-about-handler
|
||||
(application-about-handler))
|
||||
(tellv app orderFrontStandardAboutPanel: sender)
|
||||
(queue-about-event))
|
||||
#t]
|
||||
[-a _BOOL (application: [_id theApplication] openFile: [_NSString filename])
|
||||
(queue-file-event (string->path filename))]
|
||||
[-a _BOOL (applicationShouldHandleReopen: [_id app] hasVisibleWindows: [_BOOL has-visible?])
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
application-about-handler
|
||||
application-pref-handler
|
||||
|
||||
nothing-application-pref-handler))
|
||||
nothing-application-pref-handler
|
||||
nothing-application-about-handler))
|
||||
|
||||
(define saved-files null)
|
||||
(define afh (lambda (f)
|
||||
|
@ -26,7 +27,8 @@
|
|||
[(proc) (set! aqh proc)]
|
||||
[() aqh]))
|
||||
|
||||
(define aah void)
|
||||
(define (nothing-application-about-handler) (void))
|
||||
(define aah nothing-application-about-handler)
|
||||
(define application-about-handler
|
||||
(case-lambda
|
||||
[(proc) (set! aah proc)]
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
queue-quit-event
|
||||
queue-prefs-event
|
||||
queue-about-event
|
||||
queue-file-event
|
||||
|
||||
begin-busy-cursor
|
||||
|
@ -571,6 +572,10 @@
|
|||
;; called in event-pump thread
|
||||
(queue-event main-eventspace (application-pref-handler) 'med))
|
||||
|
||||
(define (queue-about-event)
|
||||
;; called in event-pump thread
|
||||
(queue-event main-eventspace (application-about-handler) 'med))
|
||||
|
||||
(define (queue-file-event file)
|
||||
;; called in event-pump thread
|
||||
(queue-event main-eventspace (lambda ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user