diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-01 15:18:29 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-01 15:18:29 -0500 |
| commit | be5458c0a37cf83f2392f3951233dd3f9f406c14 (patch) | |
| tree | ae358af220f4533465ca8807157889b819dcf884 /uitask_unix.go | |
| parent | c8c257f8c84c163354a2b3ba7c97bd76f2700443 (diff) | |
Major code restructure to allow Cocoa to work correctly. Cocoa requires that the application loop run on the very first OS thread created, not just an any ordinary thread. To support this, your code must now be run by the UI init code. Windows and Unix builds still work fine; Mac OS X fails for reasons I now have to debug.
Diffstat (limited to 'uitask_unix.go')
| -rw-r--r-- | uitask_unix.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/uitask_unix.go b/uitask_unix.go index fad1503..759ac1d 100644 --- a/uitask_unix.go +++ b/uitask_unix.go @@ -10,15 +10,13 @@ import ( var uitask chan func() -func ui(initDone chan error) { +func ui(main func()) error { runtime.LockOSThread() uitask = make(chan func()) if gtk_init() != true { - initDone <- fmt.Errorf("gtk_init failed (reason unknown; TODO)") - return + return fmt.Errorf("gtk_init failed (reason unknown; TODO)") } - initDone <- nil // thanks to tristan in irc.gimp.net/#gtk gdk_threads_add_idle(func() bool { @@ -29,5 +27,9 @@ func ui(initDone chan error) { } return true // don't destroy the callback }) + + go main() + gtk_main() + return nil } |
