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
+1 -1
View File
@@ -58,7 +58,7 @@ func (q *keyQueue) Frame(root *op.Ops, events *handlerEvents) {
}
} else if h.new && k != focus {
// Reset the handler on (each) first appearance, but don't trigger redraw.
events.Add(k, key.FocusEvent{Focus: false})
events.AddNoRedraw(k, key.FocusEvent{Focus: false})
}
}
if changed && focus != nil {