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