Files
gio/ui/input/input.go
T
Elias Naur a35118d522 ui: add package input for merged input
To avoid passing a queue type for each kind of input (pointer, key),
introduce package input for mapping a handler key to all input events.

Future input sources can be added without changes to programs, and
as an added bonus, event ordering is preserved across input sources.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 10:58:57 +02:00

21 lines
559 B
Go

// SPDX-License-Identifier: Unlicense OR MIT
// Package input exposes a unified interface to input sources. Subpackages
// such as pointer and key provide the interfaces for specific input types.
package input
// Events maps an event handler key to the events
// available to the handler.
type Events interface {
For(k Key) []Event
}
// Key is the stable identifier for an event handler. For a handler h, the
// key is typically &h.
type Key interface{}
// Event is the marker interface for input events.
type Event interface {
ImplementsInputEvent()
}