io/router,app: add support for directional focus moves

Implement support for up/down/right/left directional focus moves
and map Android directional pad keys to focus moves.

Fixes: https://todo.sr.ht/~eliasnaur/gio/195
References: https://github.com/tailscale/tailscale/issues/1611
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-27 10:33:22 +01:00
parent 2e9df04a7b
commit 73eabb352d
6 changed files with 205 additions and 20 deletions
+6 -1
View File
@@ -148,6 +148,10 @@ func (q *Router) Queue(events ...event.Event) bool {
return q.handlers.HadEvents()
}
func (q *Router) MoveFocus(dir FocusDirection) {
q.key.queue.MoveFocus(dir, &q.handlers)
}
// TextInputState returns the input state from the most recent
// call to Frame.
func (q *Router) TextInputState() TextInputState {
@@ -316,7 +320,8 @@ func (q *Router) collect() {
Tag: encOp.Refs[0].(event.Tag),
Hint: key.InputHint(encOp.Data[1]),
}
kc.inputOp(op)
b := pc.currentAreaBounds()
kc.inputOp(op, b)
case ops.TypeSnippet:
op := key.SnippetOp{
Tag: encOp.Refs[0].(event.Tag),