Add more deadzone specification options. (#9)

Reviewed-on: #9
Co-authored-by: Anna Rose Wiggins <annabunches@gmail.com>
Co-committed-by: Anna Rose Wiggins <annabunches@gmail.com>
This commit is contained in:
Anna Rose Wiggins 2025-07-18 23:10:12 +00:00 committed by Anna Rose Wiggins
parent 5b9dfe0967
commit 97a1acd228
20 changed files with 344 additions and 108 deletions

View file

@ -4,12 +4,12 @@ import "github.com/holoplot/go-evdev"
type RuleTargetButton struct {
DeviceName string
Device *evdev.InputDevice
Device Device
Button evdev.EvCode
Inverted bool
}
func NewRuleTargetButton(device_name string, device *evdev.InputDevice, code evdev.EvCode, inverted bool) (*RuleTargetButton, error) {
func NewRuleTargetButton(device_name string, device Device, code evdev.EvCode, inverted bool) (*RuleTargetButton, error) {
return &RuleTargetButton{
DeviceName: device_name,
Device: device,
@ -36,7 +36,7 @@ func (target *RuleTargetButton) CreateEvent(value int32, _ *string) *evdev.Input
}
}
func (target *RuleTargetButton) MatchEvent(device RuleTargetDevice, event *evdev.InputEvent) bool {
func (target *RuleTargetButton) MatchEvent(device Device, event *evdev.InputEvent) bool {
return device == target.Device &&
event.Type == evdev.EV_KEY &&
event.Code == target.Button