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