diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-06 23:33:27 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-06 23:33:27 -0400 |
| commit | f7817f6987f83d84893466ee4f8a99af98ee643f (patch) | |
| tree | f5562d591887582e1fd720bbf86c2eb83c7fbbaa /delegate_darwin.go | |
| parent | af770340c9d73a60a1484fd3793ab3a2d4e1076b (diff) | |
Added (untested; VM issues) code to handle Mac OS X Quit Dock menu items and other related stuff that may happen in the future. Will drop the TODO after I can test it.
Diffstat (limited to 'delegate_darwin.go')
| -rw-r--r-- | delegate_darwin.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/delegate_darwin.go b/delegate_darwin.go index 00bdf6e..a8140e2 100644 --- a/delegate_darwin.go +++ b/delegate_darwin.go @@ -12,6 +12,7 @@ This creates a class goAppDelegate that will be used as the delegate for /everyt - handles window close events (windowShouldClose:) - handles window resize events (windowDidResize:) - handles button click events (buttonClicked:) + - handles the application-global Quit event (such as from the Dock) (applicationShouldTerminate) */ // #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit @@ -45,6 +46,8 @@ 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, + "handling Quit menu items (such as from the Dock)/the AppQuit channel"}, } func mkAppDelegate() error { @@ -94,3 +97,12 @@ func appDelegate_buttonClicked(self C.id, sel C.SEL, button C.id) { sysData := getSysData(button) sysData.signal() } + +//export appDelegate_applicationShouldTerminate +func appDelegate_applicationShouldTerminate() { + // asynchronous so as to return control to the event loop + go func() { + AppQuit <- struct{}{} + }() + // xxx in bleh_darwin.m tells Cocoa not to quit +} |
