io/router: remove unnecessary panics while routing key ops

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2021-10-23 12:33:52 +02:00
committed by Elias Naur
parent da0e1bd439
commit 241e566053
2 changed files with 11 additions and 32 deletions
-29
View File
@@ -3,7 +3,6 @@
package router
import (
"gioui.org/internal/ops"
"gioui.org/io/event"
"gioui.org/io/key"
)
@@ -130,34 +129,6 @@ func (k *keyCollector) inputOp(op key.InputOp) {
h.hint = op.Hint
}
func decodeKeyInputOp(d []byte, refs []interface{}) key.InputOp {
if ops.OpType(d[0]) != ops.TypeKeyInput {
panic("invalid op")
}
return key.InputOp{
Tag: refs[0].(event.Tag),
Hint: key.InputHint(d[1]),
}
}
func decodeSoftKeyboardOp(d []byte, refs []interface{}) key.SoftKeyboardOp {
if ops.OpType(d[0]) != ops.TypeKeySoftKeyboard {
panic("invalid op")
}
return key.SoftKeyboardOp{
Show: d[1] != 0,
}
}
func decodeFocusOp(d []byte, refs []interface{}) key.FocusOp {
if ops.OpType(d[0]) != ops.TypeKeyFocus {
panic("invalid op")
}
return key.FocusOp{
Tag: refs[0],
}
}
func (t TextInputState) String() string {
switch t {
case TextInputKeep: