andlabs-ui/redo/uitask_unix.go

35 lines
572 B
Go
Raw Normal View History

// 7 july 2014
package ui
import (
"unsafe"
)
// #cgo pkg-config: gtk+-3.0
// #include "gtk_unix.h"
// extern gboolean doissue(gpointer data);
import "C"
func uiinit() error {
// TODO replace with the eerror-checking version
C.gtk_init()
return nil
}
func uimsgloop() {
C.gtk_main()
}
func issue(req *Request) {
C.gdk_threads_add_idle(C.GSourceFunc(C.doissue), C.gpointer(unsafe.Pointer(req)))
}
//export doissue
func doissue(data C.gpointer) C.gboolean {
req := (*Request)(unsafe.Pointer(data))
req.op()
close(req.done)
return C.FALSE // don't repeat
}