wrap accepts button.Parser
This commit is contained in:
@@ -3,7 +3,6 @@ package wrap
|
||||
import (
|
||||
"context"
|
||||
"mayhem-party/src/device/input/button"
|
||||
"mayhem-party/src/device/input/raw"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
@@ -13,14 +12,9 @@ type Wrap interface {
|
||||
Close()
|
||||
}
|
||||
|
||||
func New(ctx context.Context, src raw.Raw) Wrap {
|
||||
func New(ctx context.Context, src button.Parser) Wrap {
|
||||
maker := func() Wrap {
|
||||
return explicit{src: src}
|
||||
}
|
||||
if os.Getenv("WRAP_PROTOCOL") == "true" {
|
||||
maker = func() Wrap {
|
||||
return NewProtocol(src)
|
||||
}
|
||||
return src
|
||||
}
|
||||
if os.Getenv("WRAP_BUFFERED") == "true" {
|
||||
oldMaker := maker
|
||||
@@ -43,13 +37,3 @@ func New(ctx context.Context, src raw.Raw) Wrap {
|
||||
}
|
||||
return maker()
|
||||
}
|
||||
|
||||
type explicit struct {
|
||||
src raw.Raw
|
||||
}
|
||||
|
||||
func (e explicit) Close() {
|
||||
e.src.Close()
|
||||
}
|
||||
|
||||
func (e explicit) Read() []button.Button {
|
||||
|
||||
Reference in New Issue
Block a user