io/router: avoid a decode round for key ops

Like a previous change for pointer ops, process key ops during the
router decode of ops. This is a performance optimization and preparation
for processing future accessibility ops without without another decode
loop.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-10-22 14:38:08 +02:00
parent 60846d112b
commit e4b96cb779
3 changed files with 81 additions and 48 deletions
+4 -4
View File
@@ -268,14 +268,14 @@ func assertKeyEventUnexpected(t *testing.T, events []event.Event) {
func assertFocus(t *testing.T, router *Router, expected event.Tag) {
t.Helper()
if router.kqueue.focus != expected {
t.Errorf("expected %v to be focused, got %v", expected, router.kqueue.focus)
if got := router.key.queue.focus; got != expected {
t.Errorf("expected %v to be focused, got %v", expected, got)
}
}
func assertKeyboard(t *testing.T, router *Router, expected TextInputState) {
t.Helper()
if router.kqueue.state != expected {
t.Errorf("expected %v keyboard, got %v", expected, router.kqueue.state)
if got := router.key.queue.state; got != expected {
t.Errorf("expected %v keyboard, got %v", expected, got)
}
}