Exemple #1
0
func (t *trigger) handleEvent(val int) {
	if val >= t.threshold && !t.active {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, t.down)
		t.active = true
	} else if val < t.threshold && t.active {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, t.up)
		t.active = false
	}
}
Exemple #2
0
func (a *axis) handleEvent(val int) {
	if val <= -a.threshold && !a.negative {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, a.nDown)
		a.negative = true
	} else if val > -a.threshold && a.negative {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, a.nUp)
		a.negative = false
	}

	if val >= a.threshold && !a.positive {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, a.pDown)
		a.positive = true
	} else if val < a.threshold && a.positive {
		C.CGEventPost(C.kCGAnnotatedSessionEventTap, a.pUp)
		a.positive = false
	}
}
Exemple #3
0
func (b *button) handleDown() {
	C.CGEventPost(C.kCGAnnotatedSessionEventTap, b.down)
}
Exemple #4
0
func (b *button) handleUp() {
	C.CGEventPost(C.kCGAnnotatedSessionEventTap, b.up)
}