io/router,widget: give every key.InputOp a chance to process events

If the currently focused handler don't want the key event, try every
other handler, from top to bottom. This change requires widgets to
only react when focused.

Fixes: https://todo.sr.ht/~eliasnaur/gio/406
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-23 15:36:45 +02:00
parent 0273203743
commit 2381c5ad70
4 changed files with 6 additions and 35 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
e.focused = false
}
case key.Event:
if ev.State != key.Release {
if !e.focused || ev.State != key.Release {
break
}
if ev.Name != key.NameEnter && ev.Name != key.NameSpace {