forked from joejulian/gio
io/key: [API] implement key event propagation
Before this change, every Event would be passed to the focused InputOp tag, making it impossible to implement, say, program-wide shortcuts. This change implements key.Event routing similar to how pointer.Events are routed: every InputOp describes the set of keys it can handle, and the router use that information to deliver an Event to the matching handler. This is an API change, because every InputOp must now include a filter matching the keys it wants to handle. Fixes: https://todo.sr.ht/~eliasnaur/gio/395 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ func (b *Clickable) Layout(gtx layout.Context, w layout.Widget) layout.Dimension
|
||||
semantic.DisabledOp(disabled).Add(gtx.Ops)
|
||||
b.click.Add(gtx.Ops)
|
||||
if !disabled {
|
||||
key.InputOp{Tag: &b.keyTag}.Add(gtx.Ops)
|
||||
key.InputOp{Tag: &b.keyTag, Keys: "⏎|Space"}.Add(gtx.Ops)
|
||||
} else {
|
||||
b.focused = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user