andlabs-ui/redo/uitask_unix.go

36 lines
585 B
Go

// +build !darwin
// 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 error-checking version
C.gtk_init(nil, nil)
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))
perform(req)
return C.FALSE // don't repeat
}