Start rulemapping refactor to be more explicit about typing intentions.
This commit is contained in:
parent
08fc828b46
commit
a0949e719f
10 changed files with 128 additions and 100 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue