mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
io/router: expand Router.Add to accept multiple events
Niver API and useful for testing. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+10
-8
@@ -79,14 +79,16 @@ func (q *Router) Frame(ops *op.Ops) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Router) Add(e event.Event) bool {
|
func (q *Router) Add(events ...event.Event) bool {
|
||||||
switch e := e.(type) {
|
for _, e := range events {
|
||||||
case profile.Event:
|
switch e := e.(type) {
|
||||||
q.profile = e
|
case profile.Event:
|
||||||
case pointer.Event:
|
q.profile = e
|
||||||
q.pqueue.Push(e, &q.handlers)
|
case pointer.Event:
|
||||||
case key.EditEvent, key.Event, key.FocusEvent:
|
q.pqueue.Push(e, &q.handlers)
|
||||||
q.kqueue.Push(e, &q.handlers)
|
case key.EditEvent, key.Event, key.FocusEvent:
|
||||||
|
q.kqueue.Push(e, &q.handlers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return q.handlers.HadEvents()
|
return q.handlers.HadEvents()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user