summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-07 12:46:09 -0400
committerPietro Gagliardi <[email protected]>2014-04-07 12:46:09 -0400
commit24d40fa12d184ebd595344c5c1775d0175a2f4d1 (patch)
treea1ba629b6666dc407cbe8898e986c757ca8528f7
parentf7817f6987f83d84893466ee4f8a99af98ee643f (diff)
Fixed AppQuit on Mac OS X (forgot to set the NSApp delegate AND was using the wrong selector).
-rw-r--r--bleh_darwin.m2
-rw-r--r--delegate_darwin.go2
-rw-r--r--objc_darwin.go16
-rw-r--r--uitask_darwin.go2
4 files changed, 12 insertions, 10 deletions
diff --git a/bleh_darwin.m b/bleh_darwin.m
index 6094eeb..8653e74 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -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
diff --git a/delegate_darwin.go b/delegate_darwin.go
index a8140e2..53eb361 100644
--- a/delegate_darwin.go
+++ b/delegate_darwin.go
@@ -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"},
}
diff --git a/objc_darwin.go b/objc_darwin.go
index b4b44e8..855dc58 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -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) {
diff --git a/uitask_darwin.go b/uitask_darwin.go
index d338986..e72443e 100644
--- a/uitask_darwin.go
+++ b/uitask_darwin.go
@@ -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
}