io/input: [API] execute commands immediately

Change the semantics of commands to execute immediately. In cases where
execution of a command introduces a inconsistency, freeze event routing
and defer the command as well as queued events to the next frame.

Rename Source.Queue to Source.Execute to better fit the new command
semantics.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-11-20 16:25:05 -06:00
parent 67b58a6006
commit fc208248b7
11 changed files with 190 additions and 142 deletions
+2 -2
View File
@@ -315,7 +315,7 @@ func (s *Scroll) Update(cfg unit.Metric, q input.Source, t time.Time, axis Axis,
if e.Priority < pointer.Grabbed {
slop := cfg.Dp(touchSlop)
if dist := dist; dist >= slop || -slop >= dist {
q.Queue(pointer.GrabCmd{Tag: s, ID: e.PointerID})
q.Execute(pointer.GrabCmd{Tag: s, ID: e.PointerID})
}
} else {
s.last = v
@@ -389,7 +389,7 @@ func (d *Drag) Update(cfg unit.Metric, q input.Source, axis Axis) []pointer.Even
diff := e.Position.Sub(d.start)
slop := cfg.Dp(touchSlop)
if diff.X*diff.X+diff.Y*diff.Y > float32(slop*slop) {
q.Queue(pointer.GrabCmd{Tag: d, ID: e.PointerID})
q.Execute(pointer.GrabCmd{Tag: d, ID: e.PointerID})
}
}
case pointer.Release, pointer.Cancel: