io/router: don't trigger redraw for handler reset events

key.InputOp and pointer.InputOp handlers are reset on first registration
through a key.FocusEvent{false} or pointer.Cancel, respectively.

However, the mere act of registering a handle shouldn't result in a
redraw. This is particularly true for misconfigured handlers where a new
tag is supplied every frame, resulting in continously redrawing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-01-22 12:56:02 +01:00
parent e70a16c345
commit 24f69bf4bb
5 changed files with 52 additions and 3 deletions
+3 -1
View File
@@ -145,7 +145,9 @@ func (q *pointerQueue) collectHandlers(r *ops.Reader, events *handlerEvents) {
if !ok {
h = new(pointerHandler)
q.handlers[op.Tag] = h
events.Add(op.Tag, pointer.Event{Type: pointer.Cancel})
// Cancel handlers on (each) first appearance, but don't
// trigger redraw.
events.AddNoRedraw(op.Tag, pointer.Event{Type: pointer.Cancel})
}
h.active = true
h.area = state.area