summaryrefslogtreecommitdiff
path: root/redo/window_darwin.go
diff options
context:
space:
mode:
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 }