Big Refactor (#2)

Refactor Everything.

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-08 03:26:24 +00:00 committed by Anna Rose
parent a0949e719f
commit ff38db6596
21 changed files with 413 additions and 309 deletions

View file

@ -13,11 +13,16 @@ type RuleTarget interface {
// (e.g., inverting the value if Inverted == true)
NormalizeValue(int32) int32
// CreateEvent typically takes the (probably normalized) value and returns an event that can be emitted
// on a virtual device.
//
// MatchEvent returns true if the provided device and input event are a match for this rule target
ValidateEvent(*evdev.InputDevice, *evdev.InputEvent) bool
// CreateEvent creates an event that can be emitted on a virtual device.
// For RuleTargetModeSelect, this method modifies the active mode and returns nil.
//
// TODO: should we normalize inside this function to simplify the interface?
// CreateEvent does not do any error checking; it assumes it is receiving verified and sanitized output.
// The caller is responsible for determining whether an event *should* be emitted.
//
// Typically int32 is the input event's normalized value. *string is the current mode, but is optional
// for most implementations.
CreateEvent(int32, *string) *evdev.InputEvent
}