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:
Elias Naur
2019-06-07 21:41:09 +02:00
parent 28dd25736f
commit a35118d522
10 changed files with 172 additions and 130 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"gioui.org/ui"
"gioui.org/ui/draw"
"gioui.org/ui/gesture"
"gioui.org/ui/input"
"gioui.org/ui/pointer"
)
@@ -64,7 +65,7 @@ func (l *List) Dragging() bool {
return l.scroll.Dragging()
}
func (l *List) Update(c *ui.Config, q pointer.Events) {
func (l *List) Update(c *ui.Config, q input.Events) {
l.Distance = 0
d := l.scroll.Update(c, q, gesture.Axis(l.Axis))
l.scrollDir = d