summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-01 17:01:28 -0500
committerPietro Gagliardi <[email protected]>2014-03-01 17:01:28 -0500
commit56eb64429d64a7948ce8c40e823710a9ece876ec (patch)
tree123ce47499151dd81065bf61871c395db2c589e5
parent9b4e30ccf9b1a1dc6367b0e6950fdd74cde88922 (diff)
Fixed most errors. Now I just need to add a sysData pool.
-rw-r--r--bleh_darwin.m3
-rw-r--r--delegate_darwin.go6
-rw-r--r--objc_darwin.h9
-rw-r--r--uitask_darwin.go1
4 files changed, 13 insertions, 6 deletions
diff --git a/bleh_darwin.m b/bleh_darwin.m
index f513d4f..04f8930 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -15,6 +15,9 @@ Go wrapper functions (bleh_darwin.go) call these directly and take care of stdin
#include <Foundation/NSGeometry.h>
+/* exception to the above: cgo doesn't like Nil and delegate_darwin.go has //export so I can't have this there */
+Class NilClass = Nil;
+
/*
NSUInteger is listed as being in <objc/NSObjCRuntime.h>... which doesn't exist. Rather than relying on undocumented header file locations or explicitly typedef-ing NSUInteger to the (documented) unsigned long, I'll just place things here for maximum safety. I use uintptr_t as that should encompass every possible unsigned long.
*/
diff --git a/delegate_darwin.go b/delegate_darwin.go
index e903a13..dce4e4d 100644
--- a/delegate_darwin.go
+++ b/delegate_darwin.go
@@ -19,8 +19,6 @@ This creates a class goAppDelegate that will be used as the delegate for /everyt
// #include "objc_darwin.h"
// extern void appDelegate_uitask(id, SEL, id); /* from uitask_darwin.go */
// extern BOOL appDelegate_windowShouldClose(id, SEL, id);
-// /* because cgo doesn't like Nil */
-// static Class NilClass = Nil;
import "C"
var (
@@ -37,9 +35,7 @@ var (
)
func mkAppDelegate() error {
- var appdelegateclass C.Class
-
- appdelegateclass, err = makeDelegateClass(_goAppDelegate)
+ appdelegateclass, err := makeDelegateClass(_goAppDelegate)
if err != nil {
return fmt.Errorf("error creating NSApplication delegate: %v", err)
}
diff --git a/objc_darwin.h b/objc_darwin.h
index 173f238..1c960d5 100644
--- a/objc_darwin.h
+++ b/objc_darwin.h
@@ -10,12 +10,19 @@ Furthermore, Objective-C selectors work by basically sending the arguments to ob
The format should be self-explanatory.
*/
+/* for some reason I now have to use an include guard after commit [master 9b4e30c] ("Started to build a single global delegate object; now to fix issues.") */
+#ifndef _OBJC_DARWIN_H_
+#define _OBJC_DARWIN_H_
+
#include <objc/message.h>
#include <objc/objc.h>
#include <objc/runtime.h>
#include <stdint.h>
+/* for delegate_darwin.go */
+extern Class NilClass;
+
inline id objc_msgSend_noargs(id obj, SEL sel)
{
return objc_msgSend(obj, sel);
@@ -77,3 +84,5 @@ m3(sel_id_bool, SEL, id, BOOL)
extern id _objc_msgSend_rect_uint_uint_bool(id obj, SEL sel, int64_t x, int64_t y, int64_t w, int64_t h, uintptr_t b, uintptr_t c, BOOL d);
m4(id_sel_id_id, id, SEL, id, id)
+
+#endif
diff --git a/uitask_darwin.go b/uitask_darwin.go
index 493fd8c..c77bb2f 100644
--- a/uitask_darwin.go
+++ b/uitask_darwin.go
@@ -2,7 +2,6 @@
package ui
import (
- "fmt"
"runtime"
"unsafe"
)