Migrated main.go. Migrated link_darwin_amd64.go and removed -DMACOSX_DEPLOYMENT_TARGET (see libui commit aa28904408fb75ae8042c616982c13cbe2a5a784). This should be two separate commits but I screwed up.
This commit is contained in:
parent
f0fb0f4f7e
commit
c91b665da3
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
// #cgo CFLAGS: -mmacosx-version-min=10.8 -DMACOSX_DEPLOYMENT_TARGET=10.8
|
// #cgo CFLAGS: -mmacosx-version-min=10.8
|
||||||
// #cgo LDFLAGS: ${SRCDIR}/libui_darwin_amd64.a -framework Foundation -framework AppKit -mmacosx-version-min=10.8
|
// #cgo LDFLAGS: ${SRCDIR}/libui_darwin_amd64.a -framework Foundation -framework AppKit -mmacosx-version-min=10.8
|
||||||
import "C"
|
import "C"
|
|
@ -10,18 +10,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "ui.h"
|
// #include "ui.h"
|
||||||
// extern void doQueued(void *);
|
// extern void doQueueMain(void *);
|
||||||
// extern int doOnShouldQuit(void *);
|
// extern int doOnShouldQuit(void *);
|
||||||
// /* I forgot how dumb cgo is... ./main.go:73: cannot use _Cgo_ptr(_Cfpvar_fp_doQueued) (type unsafe.Pointer) as type *[0]byte in argument to _Cfunc_uiQueueMain */
|
// extern int doOnTimer(void *);
|
||||||
// /* I'm pretty sure this worked before... */
|
|
||||||
// static inline void realQueueMain(void *x)
|
|
||||||
// {
|
|
||||||
// uiQueueMain(doQueued, x);
|
|
||||||
// }
|
|
||||||
// static inline void realOnShouldQuit(void)
|
|
||||||
// {
|
|
||||||
// uiOnShouldQuit(doOnShouldQuit, NULL);
|
|
||||||
// }
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// make sure main() runs on the first thread created by the OS
|
// make sure main() runs on the first thread created by the OS
|
||||||
|
@ -48,8 +39,7 @@ func Main(f func()) error {
|
||||||
C.uiFreeInitError(estr)
|
C.uiFreeInitError(estr)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// set up OnShouldQuit()
|
C.uiOnShouldQuit(C.doOnShouldQuit, nil)
|
||||||
C.realOnShouldQuit()
|
|
||||||
QueueMain(f)
|
QueueMain(f)
|
||||||
C.uiMain()
|
C.uiMain()
|
||||||
return nil
|
return nil
|
||||||
|
@ -98,11 +88,11 @@ func QueueMain(f func()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qmmap[n] = f
|
qmmap[n] = f
|
||||||
C.realQueueMain(unsafe.Pointer(n))
|
C.uiQueueMain(C.doQueueMain, unsafe.Pointer(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
//export doQueued
|
//export doQueueMain
|
||||||
func doQueued(nn unsafe.Pointer) {
|
func doQueueMain(nn unsafe.Pointer) {
|
||||||
qmlock.Lock()
|
qmlock.Lock()
|
||||||
|
|
||||||
n := uintptr(nn)
|
n := uintptr(nn)
|
||||||
|
@ -136,3 +126,5 @@ func doOnShouldQuit(unused unsafe.Pointer) C.int {
|
||||||
}
|
}
|
||||||
return frombool(shouldQuitFunc())
|
return frombool(shouldQuitFunc())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Timer?
|
Loading…
Reference in New Issue