mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
ui/input: support single stepping through events
Change input.Events interface to return one event at a time until the queue is empty. Change text.Editor and gestures to match. Re-add Editor.Submit while we're here; we don't want to enable submit mode always. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+12
-4
@@ -83,8 +83,12 @@ func (c *Click) Add(ops *ui.Ops) {
|
||||
|
||||
func (c *Click) Update(q input.Events) []ClickEvent {
|
||||
var events []ClickEvent
|
||||
for _, e := range q.For(c) {
|
||||
e, ok := e.(pointer.Event)
|
||||
for {
|
||||
evt, ok := q.Next(c)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
e, ok := evt.(pointer.Event)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
@@ -135,8 +139,12 @@ func (s *Scroll) Update(cfg *ui.Config, q input.Events, axis Axis) int {
|
||||
return 0
|
||||
}
|
||||
total := 0
|
||||
for _, e := range q.For(s) {
|
||||
e, ok := e.(pointer.Event)
|
||||
for {
|
||||
evt, ok := q.Next(s)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
e, ok := evt.(pointer.Event)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user