ui/input: change Events to return all events at once

Single stepping events only makes sense for widgets with complex
state, e.g. the text.Editor. For the input.Events source, returning
all events in a single Events call is sufficient and more natural
for clients.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-11 23:39:25 +02:00
parent a9d4186bef
commit 1735d5ced8
4 changed files with 7 additions and 23 deletions
+2 -10
View File
@@ -82,11 +82,7 @@ func (c *Click) Add(ops *ui.Ops) {
}
func (c *Click) Next(q input.Events) (ClickEvent, bool) {
for {
evt, ok := q.Next(c)
if !ok {
break
}
for _, evt := range q.Events(c) {
e, ok := evt.(pointer.Event)
if !ok {
continue
@@ -139,11 +135,7 @@ func (s *Scroll) Scroll(cfg ui.Config, q input.Events, axis Axis) int {
return 0
}
total := 0
for {
evt, ok := q.Next(s)
if !ok {
break
}
for _, evt := range q.Events(s) {
e, ok := evt.(pointer.Event)
if !ok {
continue