Improved the error reporting facilities of uiinit() on Mac OS X. Not used yet, though...

This commit is contained in:
Pietro Gagliardi 2014-08-10 22:24:08 -04:00
parent 37b1c3309b
commit a172143fe6
3 changed files with 10 additions and 5 deletions

View File

@ -38,7 +38,7 @@ struct xpoint {
/* uitask_darwin.m */
extern id getAppDelegate(void); /* used by the other .m files */
extern BOOL uiinit(void);
extern void uiinit(char **);
extern void uimsgloop(void);
extern void uistop(void);
extern void issue(void *);

View File

@ -3,6 +3,7 @@
package ui
import (
"fmt"
"unsafe"
)
@ -12,8 +13,13 @@ import (
import "C"
func uiinit() error {
// TODO check error
C.uiinit()
var errmsg *C.char
errmsg = nil
C.uiinit(&errmsg)
if errmsg != nil {
return fmt.Errorf("package ui initialization failed: %s", C.GoString(errmsg))
}
return nil
}

View File

@ -56,7 +56,7 @@ id getAppDelegate(void)
return appDelegate;
}
BOOL uiinit(void)
void uiinit(char **errmsg)
{
areaClass = getAreaClass();
appDelegate = [appDelegateClass new];
@ -66,7 +66,6 @@ BOOL uiinit(void)
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp activateIgnoringOtherApps:YES]; // TODO rsc does this; finder says NO?
[NSApp setDelegate:appDelegate];
return YES;
}
void uimsgloop(void)