mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: [API] deliver key events to the first matching filter
Replace the key.Filter.Target field with a Focus field that matches only of the specified tag has focus. This has the advantage of simpler event delivery and for lower latency in delivering key events to new handlers. For example, consider a UI where a button is activated by a key press, which is turn displays a dialog with another button activated by the same key. This change allows two button press(+releases) in the same frame to arrive at the intended targets: one key press(+release) for each button. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-8
@@ -1,12 +1,6 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
/*
|
||||
Package key implements key and text events and operations.
|
||||
|
||||
The InputOp operations is used for declaring key input handlers. Use
|
||||
an implementation of the Queue interface from package ui to receive
|
||||
events.
|
||||
*/
|
||||
// Package key implements key and text events and operations.
|
||||
package key
|
||||
|
||||
import (
|
||||
@@ -20,7 +14,9 @@ import (
|
||||
|
||||
// Filter matches any [Event] that matches the parameters.
|
||||
type Filter struct {
|
||||
Target event.Tag
|
||||
// Focus is the tag that must be focused for the filter to match. It has no effect
|
||||
// if it is nil.
|
||||
Focus event.Tag
|
||||
// Required is the set of modifiers that must be included in events matched.
|
||||
Required Modifiers
|
||||
// Optional is the set of modifiers that may be included in events matched.
|
||||
|
||||
Reference in New Issue
Block a user