Made programs go to the front of the screen on Mac OS X like other programs do (and like on other platforms).

This commit is contained in:
Pietro Gagliardi 2014-03-12 10:02:59 -04:00
parent 95e20a5f3c
commit 6eea59c30a
1 changed files with 2 additions and 1 deletions

View File

@ -79,6 +79,7 @@ var (
_sharedApplication = sel_getUid("sharedApplication") _sharedApplication = sel_getUid("sharedApplication")
_setActivationPolicy = sel_getUid("setActivationPolicy:") _setActivationPolicy = sel_getUid("setActivationPolicy:")
_activateIgnoringOtherApps = sel_getUid("activateIgnoringOtherApps:")
) )
func initCocoa() (NSApp C.id, err error) { func initCocoa() (NSApp C.id, err error) {
@ -89,7 +90,7 @@ func initCocoa() (NSApp C.id, err error) {
err = fmt.Errorf("error setting NSApplication activation policy (basically identifies our program as a separate program; needed for several things, such as Dock icon, application menu, window resizing, etc.) (unknown reason)") err = fmt.Errorf("error setting NSApplication activation policy (basically identifies our program as a separate program; needed for several things, such as Dock icon, application menu, window resizing, etc.) (unknown reason)")
return return
} }
// TODO we need to call [NSApp activateIgnoringOtherApps:YES] here when we are ready to have the program become active (for now I won't) C.objc_msgSend_bool(NSApp, _activateIgnoringOtherApps, C.BOOL(C.YES)) // TODO actually do C.NO here? Russ Cox does YES in his devdraw; the docs say the Finder does NO
err = mkAppDelegate() err = mkAppDelegate()
return return
} }