* Move all physical device initialization logic to main functions
* Move all virtual device initialization to virtualbuffer package. * Factor out common eventcode helper logic into a new package.
This commit is contained in:
parent
1b374bccc6
commit
727985f91c
17 changed files with 777 additions and 771 deletions
|
@ -14,9 +14,8 @@ import (
|
|||
// This would speed up rule matching by only checking relevant rules for a given input event.
|
||||
// We could take this further and make it a map[<struct of *inputdevice, type, and code>][]rule
|
||||
// For very large rule-bases this may be helpful for staying performant.
|
||||
func (parser *ConfigParser) InitRules(pInputDevs map[string]*evdev.InputDevice, vInputDevs map[string]*evdev.InputDevice) []mappingrules.MappingRule {
|
||||
func InitRules(config []RuleConfig, pInputDevs map[string]*evdev.InputDevice, vInputDevs map[string]*evdev.InputDevice, modes []string) []mappingrules.MappingRule {
|
||||
rules := make([]mappingrules.MappingRule, 0)
|
||||
modes := parser.GetModes()
|
||||
|
||||
// Golang can't inspect the concrete map type to determine interface conformance,
|
||||
// so we handle that here.
|
||||
|
@ -29,7 +28,7 @@ func (parser *ConfigParser) InitRules(pInputDevs map[string]*evdev.InputDevice,
|
|||
vDevs[name] = dev
|
||||
}
|
||||
|
||||
for _, ruleConfig := range parser.config.Rules {
|
||||
for _, ruleConfig := range config {
|
||||
var newRule mappingrules.MappingRule
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue