예제 #1
0
파일: trayhost.go 프로젝트: Comdex/trayhost
// Run the host system's event loop
func EnterLoop(title string, imageData []byte) {
	defer C.free(urlPtr)

	cTitle := C.CString(title)
	defer C.free(unsafe.Pointer(cTitle))

	// Copy the image data into unmanaged memory
	cImageData := C.malloc(C.size_t(len(imageData)))
	defer C.free(cImageData)
	var cImageDataSlice []C.uchar
	sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&cImageDataSlice))
	sliceHeader.Cap = len(imageData)
	sliceHeader.Len = len(imageData)
	sliceHeader.Data = uintptr(cImageData)

	for i, v := range imageData {
		cImageDataSlice[i] = C.uchar(v)
	}

	// Enter the loop
	C.native_loop(cTitle, &cImageDataSlice[0], C.uint(len(imageData)))

	// If reached, user clicked Exit
	isExiting = true
}
예제 #2
0
// EnterLoop enters main loop.
func EnterLoop() {
	C.native_loop()
}
예제 #3
0
func EnterLoop() {
	go menuUpdateLoop()
	C.native_loop()
	isExiting = true
}