mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
+1
-1
@@ -166,7 +166,7 @@ func (b *Clickable) update(gtx layout.Context) {
|
||||
case key.FocusEvent:
|
||||
b.focused = e.Focus
|
||||
case key.Event:
|
||||
if e.State != key.Release {
|
||||
if !b.focused || e.State != key.Release {
|
||||
break
|
||||
}
|
||||
if e.Name != key.NameReturn && e.Name != key.NameSpace {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user