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:
Elias Naur
2022-04-14 12:18:00 +02:00
parent bec0283e54
commit 380f96b3fc
13 changed files with 266 additions and 46 deletions
+6 -2
View File
@@ -5,6 +5,10 @@
package key
// ModShortcut is the platform's shortcut modifier, usually the Ctrl
// key. On Apple platforms it is the Cmd key.
// ModShortcut is the platform's shortcut modifier, usually the ctrl
// modifier. On Apple platforms it is the cmd key.
const ModShortcut = ModCtrl
// ModShortcutAlt is the platform's alternative shortcut modifier,
// usually the ctrl modifier. On Apple platforms it is the alt modifier.
const ModShortcutAlt = ModCtrl