io/pointer: add InputOp.Types to specify which types of events to receive

Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
Gordon Klaus
2020-06-03 15:22:48 +02:00
committed by Elias Naur
parent 4484674ab1
commit 9d2a6c48d8
7 changed files with 102 additions and 19 deletions
+9 -2
View File
@@ -112,7 +112,10 @@ var touchSlop = unit.Dp(3)
// Add the handler to the operation list to receive click events.
func (c *Click) Add(ops *op.Ops) {
op := pointer.InputOp{Tag: c}
op := pointer.InputOp{
Tag: c,
Types: pointer.Press | pointer.Release | pointer.Enter | pointer.Leave,
}
op.Add(ops)
}
@@ -168,7 +171,11 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
// Add the handler to the operation list to receive scroll events.
func (s *Scroll) Add(ops *op.Ops) {
oph := pointer.InputOp{Tag: s, Grab: s.grab}
oph := pointer.InputOp{
Tag: s,
Grab: s.grab,
Types: pointer.Press | pointer.Move | pointer.Release | pointer.Scroll,
}
oph.Add(ops)
if s.flinger.Active() {
op.InvalidateOp{}.Add(ops)