Implement config generator for AxisToButton. Use RuleTargetDevice interface more broadly.

This commit is contained in:
Anna Rose Wiggins 2025-07-12 17:14:57 -04:00
parent e93187b8a5
commit ed2627e113
9 changed files with 28 additions and 16 deletions

View file

@ -3,7 +3,7 @@ package mappingrules
import "github.com/holoplot/go-evdev"
type MappingRule interface {
MatchEvent(*evdev.InputDevice, *evdev.InputEvent, *string) (*evdev.InputDevice, *evdev.InputEvent)
MatchEvent(RuleTargetDevice, *evdev.InputEvent, *string) (*evdev.InputDevice, *evdev.InputEvent)
}
// RuleTargets represent either a device input to match on, or an output to produce.
@ -25,6 +25,8 @@ type RuleTarget interface {
// Typically int32 is the input event's normalized value. *string is the current mode, but is optional
// for most implementations.
CreateEvent(int32, *string) *evdev.InputEvent
MatchEvent(device RuleTargetDevice, event *evdev.InputEvent) bool
}
// RuleTargetDevice is an interface abstraction on top of evdev.InputDevice, implementing