io/router: don't clear event queue before cancel events

There may be unrelated events in the queue, so it's not appropriate
to clear the queue just because an input Cancel event occurs.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-07 18:20:18 +02:00
parent d86f96503f
commit d280d438c7
3 changed files with 2 additions and 8 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ loop:
h = new(keyHandler)
q.handlers[op.Tag] = h
// Reset the handler on (each) first appearance.
events.Set(op.Tag, []event.Event{key.FocusEvent{Focus: false}})
events.Add(op.Tag, key.FocusEvent{Focus: false})
}
h.active = true
case opconst.TypeHideInput:
+1 -1
View File
@@ -104,7 +104,7 @@ func (q *pointerQueue) collectHandlers(r *ops.Reader, events *handlerEvents, t o
if !ok {
h = new(pointerHandler)
q.handlers[op.Tag] = h
events.Set(op.Tag, []event.Event{pointer.Event{Type: pointer.Cancel}})
events.Add(op.Tag, pointer.Event{Type: pointer.Cancel})
}
h.active = true
h.area = area
-6
View File
@@ -137,12 +137,6 @@ func (h *handlerEvents) init() {
}
}
func (h *handlerEvents) Set(k event.Tag, evts []event.Event) {
h.init()
h.handlers[k] = evts
h.hadEvents = true
}
func (h *handlerEvents) Add(k event.Tag, e event.Event) {
h.init()
h.handlers[k] = append(h.handlers[k], e)