Revert "gesture: only report TypePress for Click gestures if pointer is grabbed"

This reverts commit 062e2bc54b.

Reason: delays the press too much for the common case of an embedding List.
This commit is contained in:
Elias Naur
2020-05-16 12:08:27 +02:00
parent 9259b8f743
commit f2fee00bab
+1 -17
View File
@@ -36,8 +36,6 @@ type Click struct {
// clicks is incremented if successive clicks
// are performed within a fixed duration.
clicks int
// pressRep tracks whether a TypePress has been reported.
pressRep bool
}
type ClickState uint8
@@ -142,9 +140,6 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
c.clicks = 1
}
c.clickedAt = e.Time
if c.reportPress(pointer.Grabbed) {
events = append(events, ClickEvent{Type: TypePress, Position: e.Position, Source: e.Source, Modifiers: e.Modifiers})
}
events = append(events, ClickEvent{Type: TypeClick, Position: e.Position, Source: e.Source, Modifiers: e.Modifiers, NumClicks: c.clicks})
}
case pointer.Cancel:
@@ -157,10 +152,7 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
break
}
c.state = StatePressed
c.pressRep = false
if c.reportPress(e.Priority) {
events = append(events, ClickEvent{Type: TypePress, Position: e.Position, Source: e.Source, Modifiers: e.Modifiers})
}
events = append(events, ClickEvent{Type: TypePress, Position: e.Position, Source: e.Source, Modifiers: e.Modifiers})
case pointer.Leave:
if c.state == StatePressed {
c.state = StateNormal
@@ -174,14 +166,6 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
return events
}
func (c *Click) reportPress(pri pointer.Priority) bool {
send := !c.pressRep && pri == pointer.Grabbed
if send {
c.pressRep = true
}
return send
}
// Add the handler to the operation list to receive scroll events.
func (s *Scroll) Add(ops *op.Ops) {
oph := pointer.InputOp{Key: s, Grab: s.grab}