Fix inverted buttons.
This commit is contained in:
parent
288a07eb73
commit
1f6c2517c0
2 changed files with 7 additions and 4 deletions
|
@ -11,7 +11,7 @@ func (rule *MappingRuleBase) OutputName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rule *MappingRuleBase) modeCheck(mode *string) bool {
|
func (rule *MappingRuleBase) modeCheck(mode *string) bool {
|
||||||
if len(rule.Modes) == 1 && rule.Modes[0] == "*" {
|
if rule.Modes[0] == "*" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return slices.Contains(rule.Modes, *mode)
|
return slices.Contains(rule.Modes, *mode)
|
||||||
|
|
|
@ -20,10 +20,13 @@ func (target *RuleTargetBase) GetDevice() *evdev.InputDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (target *RuleTargetButton) NormalizeValue(value int32) int32 {
|
func (target *RuleTargetButton) NormalizeValue(value int32) int32 {
|
||||||
|
if target.Inverted {
|
||||||
if value == 0 {
|
if value == 0 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
|
}
|
||||||
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (target *RuleTargetButton) CreateEvent(value int32, mode *string) *evdev.InputEvent {
|
func (target *RuleTargetButton) CreateEvent(value int32, mode *string) *evdev.InputEvent {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue