Fixed AppQuit on Mac OS X (forgot to set the NSApp delegate AND was using the wrong selector).
This commit is contained in:
parent
f7817f6987
commit
24d40fa12d
|
@ -336,7 +336,7 @@ void objc_setFont(id what, unsigned int csize)
|
|||
|
||||
extern void appDelegate_applicationShouldTerminate();
|
||||
|
||||
static NSApplicationTerminateReply __appDelegate_applicationShouldTerminate(id self, SEL sel)
|
||||
static NSApplicationTerminateReply __appDelegate_applicationShouldTerminate(id self, SEL sel, id app)
|
||||
{
|
||||
appDelegate_applicationShouldTerminate();
|
||||
return NSTerminateCancel; // don't quit
|
||||
|
|
|
@ -46,7 +46,7 @@ var appDelegateSels = []selector{
|
|||
"handling window resize events"},
|
||||
selector{"buttonClicked:", uintptr(C.appDelegate_buttonClicked), sel_bool_id,
|
||||
"handling button clicks"},
|
||||
selector{"applicationShouldTerminate", uintptr(C._appDelegate_applicationShouldTerminate), sel_terminatereply,
|
||||
selector{"applicationShouldTerminate:", uintptr(C._appDelegate_applicationShouldTerminate), sel_terminatereply_id,
|
||||
"handling Quit menu items (such as from the Dock)/the AppQuit channel"},
|
||||
}
|
||||
|
||||
|
|
|
@ -71,16 +71,16 @@ const (
|
|||
sel_bool_id
|
||||
sel_bool
|
||||
sel_void_rect
|
||||
sel_terminatereply
|
||||
sel_terminatereply_id
|
||||
nitypes
|
||||
)
|
||||
|
||||
var itypes = [nitypes][]C.char{
|
||||
sel_void_id: []C.char{'v', '@', ':', '@', 0},
|
||||
sel_bool_id: []C.char{'c', '@', ':', '@', 0},
|
||||
sel_bool: []C.char{'c', '@', ':', 0},
|
||||
sel_void_rect: nil, // see init() below
|
||||
sel_terminatereply: nil,
|
||||
sel_void_id: []C.char{'v', '@', ':', '@', 0},
|
||||
sel_bool_id: []C.char{'c', '@', ':', '@', 0},
|
||||
sel_bool: []C.char{'c', '@', ':', 0},
|
||||
sel_void_rect: nil, // see init() below
|
||||
sel_terminatereply_id: nil,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -99,8 +99,8 @@ func init() {
|
|||
for _, b := range y {
|
||||
x = append(x, C.char(b))
|
||||
}
|
||||
x = append(x, '@', ':', 0)
|
||||
itypes[sel_terminatereply] = x
|
||||
x = append(x, '@', ':', '@', 0)
|
||||
itypes[sel_terminatereply_id] = x
|
||||
}
|
||||
|
||||
func makeClass(name string, super C.id, sels []selector, desc string) (id C.id, err error) {
|
||||
|
|
|
@ -81,6 +81,7 @@ var (
|
|||
_sharedApplication = sel_getUid("sharedApplication")
|
||||
_setActivationPolicy = sel_getUid("setActivationPolicy:")
|
||||
_activateIgnoringOtherApps = sel_getUid("activateIgnoringOtherApps:")
|
||||
// _setDelegate in sysdata_darwin.go
|
||||
)
|
||||
|
||||
func initCocoa() (NSApp C.id, err error) {
|
||||
|
@ -97,6 +98,7 @@ func initCocoa() (NSApp C.id, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
C.objc_msgSend_id(NSApp, _setDelegate, appDelegate)
|
||||
err = mkAreaClass()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue