summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-01 17:15:26 -0500
committerPietro Gagliardi <[email protected]>2014-03-01 17:15:26 -0500
commit5caf0fe84a81e5adbe18568eabe06f2ec674c1b3 (patch)
tree63dc442f3a40aaf1118b6a4885b8e778265d8fa2
parent8b497b2188bc735710a6ef83b0b05487a4b3ee83 (diff)
Cleaned up loose ends with the previous commit and got window close events working on Mac OS X. Woo!
-rw-r--r--delegate_darwin.go4
-rw-r--r--sysdata_darwin.go4
-rw-r--r--todo.md2
3 files changed, 6 insertions, 4 deletions
diff --git a/delegate_darwin.go b/delegate_darwin.go
index dce4e4d..f6870e6 100644
--- a/delegate_darwin.go
+++ b/delegate_darwin.go
@@ -10,7 +10,7 @@ import (
This creates a class goAppDelegate that will be used as the delegate for /everything/. Specifically, it:
- runs uitask requests (uitask:)
- handles window close events (windowShouldClose:)
- - handles window resize events (xxxx:)
+ - handles window resize events (windowDidResize: (TODO also windowDidEndLiveResize:?))
- handles button click events (buttonClick:)
*/
@@ -82,7 +82,7 @@ func makeDelegateClass(name string) (C.Class, error) {
var (
delegate_void = []C.char{'v', '@', ':', '@', 0} // void (*)(id, SEL, id)
- delegate_bool = []C.char{'#', '@', ':', '@', 0} // BOOL (*)(id, SEL, id)
+ delegate_bool = []C.char{'c', '@', ':', '@', 0} // BOOL (*)(id, SEL, id)
)
// according to errors spit out by cgo, C function pointers are unsafe.Pointer
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index 9cbbee9..797fe70 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -65,12 +65,14 @@ var classTypes = [nctypes]*classData{
// we have to specify a content rect to start; it will be overridden soon though
win := objc_alloc(_NSWindow)
- return objc_msgSend_rect_uint_uint_bool(win,
+ win = objc_msgSend_rect_uint_uint_bool(win,
_initWithContentRect,
0, 0, 100, 100,
NSTitledWindowMask | NSClosableWindowMask | NSClosableWindowMask | NSResizableWindowMask,
2, // NSBackingStoreBuffered - the only backing store method that Apple says we should use (the others are legacy)
C.BOOL(C.YES)) // defer creation of device until we show the window
+ objc_setDelegate(win, appDelegate)
+ return win
},
show: func(what C.id) {
C.objc_msgSend_id(what, _makeKeyAndOrderFront, what)
diff --git a/todo.md b/todo.md
index 7bb0a22..943620f 100644
--- a/todo.md
+++ b/todo.md
@@ -26,7 +26,7 @@ important things:
- ui.Go() should exit when the main() you pass in exits
- because the main event loop is not called if initialization fails, it is presently impossible for MsgBoxError() to work if UI initialization fails; this basically means we cannot allow initializiation to fail on Mac OS X if we want to be able to report UI init failures to the user with one
- Cocoa coordinates have (0,0) at the bottom left: need to fix this somehow
-- Cocoa windows seem to ignore the minizeable flag and closing them always works (is the latter because I don't have a delegate yet?)
+- Cocoa windows seem to ignore the minizeable flag and cannot be live-resized
- there's no GTK+ error handling whatsoever; we need to figure out how it works
- make sure GTK+ documentation point differences don't matter
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins