Start rulemapping refactor to be more explicit about typing intentions.

This commit is contained in:
Anna Rose Wiggins 2025-07-06 17:22:05 -04:00
parent 08fc828b46
commit a0949e719f
10 changed files with 128 additions and 100 deletions

View file

@ -16,19 +16,19 @@ type MappingRuleProportionalAxis struct {
LastEvent time.Time
}
func (rule *MappingRuleProportionalAxis) MatchEvent(device *evdev.InputDevice, event *evdev.InputEvent, mode *string) *evdev.InputEvent {
func (rule *MappingRuleProportionalAxis) MatchEvent(device *evdev.InputDevice, event *evdev.InputEvent, mode *string) (*evdev.InputDevice, *evdev.InputEvent) {
if !rule.MappingRuleBase.modeCheck(mode) {
return nil
return nil, nil
}
if device != rule.Input.GetDevice() ||
event.Code != rule.Input.GetCode() {
return nil
return nil, nil
}
// set the last value to the normalized input value
rule.LastValue = rule.Input.NormalizeValue(event.Value)
return nil
return nil, nil
}
// TimerEvent returns an event when enough time has passed (compared to the last recorded axis value)