summaryrefslogtreecommitdiff
path: root/uitask_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-03 11:53:21 -0400
committerPietro Gagliardi <[email protected]>2014-07-03 11:53:21 -0400
commitb460466e4b7d479a015bb686adb42056ef189abe (patch)
treef2b729088df05276473d291a70e7bdc785ebe998 /uitask_darwin.go
parent1287ba89682b98b4196db7b9f81569f2abdb5761 (diff)
Implemented Post() on Mac OS X.
Diffstat (limited to 'uitask_darwin.go')
-rw-r--r--uitask_darwin.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/uitask_darwin.go b/uitask_darwin.go
index d4bc842..d9292ff 100644
--- a/uitask_darwin.go
+++ b/uitask_darwin.go
@@ -4,6 +4,7 @@ package ui
import (
"fmt"
+ "unsafe"
)
// #cgo CFLAGS: -mmacosx-version-min=10.7 -DMACOSX_DEPLOYMENT_TARGET=10.7
@@ -32,6 +33,28 @@ func ui() {
C.cocoaMainLoop()
}
+// we're going to call the appDelegate selector with waitUntilDone:YES so we don't have to worry about garbage collection
+// we DO need to collect the two pointers together, though
+
+type uipostmsg struct {
+ w *Window
+ data interface{}
+}
+
+//export appDelegate_uipost
+func appDelegate_uipost(xmsg unsafe.Pointer) {
+ msg := (*uipostmsg)(xmsg)
+ msg.w.sysData.post(msg.data)
+}
+
+func uipost(w *Window, data interface{}) {
+ msg := &uipostmsg{
+ w: w,
+ data: data,
+ }
+ C.uipost(appDelegate, unsafe.Pointer(msg))
+}
+
func initCocoa() (err error) {
makeAppDelegate()
if C.initCocoa(appDelegate) != C.YES {