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 */ /* uitask_darwin.m */
extern id getAppDelegate(void); /* used by the other .m files */ extern id getAppDelegate(void); /* used by the other .m files */
extern BOOL uiinit(void); extern void uiinit(char **);
extern void uimsgloop(void); extern void uimsgloop(void);
extern void uistop(void); extern void uistop(void);
extern void issue(void *); extern void issue(void *);

View File

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

View File

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