mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
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>
This commit is contained in:
+6
-14
@@ -16,14 +16,6 @@ type OpHideInput struct{}
|
||||
|
||||
type Key interface{}
|
||||
|
||||
type Events interface {
|
||||
For(k Key) []Event
|
||||
}
|
||||
|
||||
type Event interface {
|
||||
isKeyEvent()
|
||||
}
|
||||
|
||||
type Focus struct {
|
||||
Focus bool
|
||||
}
|
||||
@@ -93,9 +85,9 @@ func (h OpHideInput) Add(o *ui.Ops) {
|
||||
o.Write(data)
|
||||
}
|
||||
|
||||
func (Edit) ImplementsEvent() {}
|
||||
func (Chord) ImplementsEvent() {}
|
||||
func (Focus) ImplementsEvent() {}
|
||||
func (Edit) isKeyEvent() {}
|
||||
func (Chord) isKeyEvent() {}
|
||||
func (Focus) isKeyEvent() {}
|
||||
func (Edit) ImplementsEvent() {}
|
||||
func (Chord) ImplementsEvent() {}
|
||||
func (Focus) ImplementsEvent() {}
|
||||
func (Edit) ImplementsInputEvent() {}
|
||||
func (Chord) ImplementsInputEvent() {}
|
||||
func (Focus) ImplementsInputEvent() {}
|
||||
|
||||
Reference in New Issue
Block a user