dont do raw.New, instead add raw.Raw.Refresh explicit
parent
de261ae400
commit
2cae3c6d28
|
|
@ -22,6 +22,8 @@ func TestPlaintext(t *testing.T) {
|
|||
|
||||
type constSrc string
|
||||
|
||||
func (c constSrc) Refresh() {}
|
||||
|
||||
func (c constSrc) Close() {}
|
||||
|
||||
func (c constSrc) Read() []byte {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ type Input interface {
|
|||
}
|
||||
|
||||
func New(ctx context.Context) Input {
|
||||
src := raw.New(ctx)
|
||||
return wrap.New(ctx, func() button.Parser {
|
||||
src := raw.New(ctx)
|
||||
src.Refresh()
|
||||
return button.New(ctx, src)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ func NewKeyboard() Keyboard {
|
|||
return Keyboard{}
|
||||
}
|
||||
|
||||
func (kb Keyboard) Refresh() {
|
||||
}
|
||||
|
||||
func (kb Keyboard) Close() {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ func NewRandom(generator func() byte) *Random {
|
|||
return &Random{generator: generator}
|
||||
}
|
||||
|
||||
func (r *Random) Refresh() {
|
||||
}
|
||||
|
||||
func (r *Random) Close() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
type Raw interface {
|
||||
Read() []byte
|
||||
Close()
|
||||
Refresh()
|
||||
}
|
||||
|
||||
func New(ctx context.Context) Raw {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ func (udp UDP) Read() []byte {
|
|||
}
|
||||
}
|
||||
|
||||
func (udp UDP) Refresh() {
|
||||
}
|
||||
|
||||
func (udp UDP) Close() {
|
||||
udp.conn.Close()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue