Esempio n. 1
0
func UnregisterKeySniffer(callback KeySnifferCallback, beforeWindows bool, ref interface{}) bool {
	var id *C.char
	for key, info := range keySnifferCallbacks {
		if info.funcPointerAsString == fmt.Sprint(callback) && info.ref == ref {
			id = key
			defer C.free(unsafe.Pointer(id))
		}
	}
	return C.XPLMUnregisterKeySniffer(C.XPLMKeySniffer_f(unsafe.Pointer(C.keySnifferCallback)), C.int(goplane.FromBoolToInt(beforeWindows)), unsafe.Pointer(id)) == 1
}
Esempio n. 2
0
func RegisterKeySniffer(callback KeySnifferCallback, beforeWindows bool, ref interface{}) bool {
	id := C.CString(goplane.IdGenerator())
	keySnifferCallbacks[id] = regSnifferData{fmt.Sprint(callback), callback, ref}
	return C.XPLMRegisterKeySniffer(C.XPLMKeySniffer_f(unsafe.Pointer(C.keySnifferCallback)), C.int(goplane.FromBoolToInt(beforeWindows)), unsafe.Pointer(id)) == 1
}