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 }
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 }