summaryrefslogtreecommitdiff
path: root/redo/window_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-08 17:43:50 -0400
committerPietro Gagliardi <[email protected]>2014-07-08 17:44:08 -0400
commit44811e5351c13917f400fe5eed0145e224f0c43e (patch)
treea06e521b64197002196737f09c0f781c38654fb2 /redo/window_darwin.go
parentedd81e2e48d4e2c14820370dd5829fecaf19d387 (diff)
Implemented window closing on Mac OS X. This drops the "single delegate object for everything" setup but keeping that map and holding its lock is already meh so.
Diffstat (limited to 'redo/window_darwin.go')
-rw-r--r--redo/window_darwin.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/redo/window_darwin.go b/redo/window_darwin.go
index c6d9585..c3d4521 100644
--- a/redo/window_darwin.go
+++ b/redo/window_darwin.go
@@ -23,11 +23,12 @@ func newWindow(title string, width int, height int) *Request {
ctitle := C.CString(title)
defer C.free(unsafe.Pointer(ctitle))
C.windowSetTitle(id, ctitle)
- C.windowSetAppDelegate(id)
- c <- &window{
+ w := &window{
id: id,
closing: newEvent(),
}
+ C.windowSetDelegate(id, unsafe.Pointer(w))
+ c <- w
},
resp: c,
}
@@ -112,7 +113,17 @@ func (w *window) OnClosing(e func(c Doer) bool) *Request {
}
}
-// TODO windowClosing
+//export windowClosing
+func windowClosing(xw unsafe.Pointer) C.BOOL {
+ w := (*window)(unsafe.Pointer(xw))
+ close := w.closing.fire()
+ if close {
+ // TODO make sure this actually closes the window the way we want
+ return C.YES
+ }
+ return C.NO
+}
+
// TODO for testing
func newButton(string) *Request { return nil }