mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
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:
+2
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user