Commit 9b3e0e80 authored by Peter Hutterer's avatar Peter Hutterer

tools: per-slot-delta: if a NONE touch gets data, assume it's starting

If we have a recording that started after the touch down, let's start that
touch on the first x/y position update.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 9ecac89b
Pipeline #155788 passed with stages
in 22 minutes and 18 seconds
......@@ -227,12 +227,20 @@ def main(argv):
else:
s.state = SlotState.END
elif e.code == libevdev.EV_ABS.ABS_X:
if s.state == SlotState.UPDATE:
# If recording started after touch down
if s.state == SlotState.NONE:
s.state = SlotState.BEGIN
s.dx, s.dy = 0, 0
elif s.state == SlotState.UPDATE:
s.dx = e.value - s.x
s.x = e.value
s.dirty = True
elif e.code == libevdev.EV_ABS.ABS_Y:
if s.state == SlotState.UPDATE:
# If recording started after touch down
if s.state == SlotState.NONE:
s.state = SlotState.BEGIN
s.dx, s.dy = 0, 0
elif s.state == SlotState.UPDATE:
s.dy = e.value - s.y
s.y = e.value
s.dirty = True
......@@ -254,12 +262,20 @@ def main(argv):
s.dy = 0
s.dirty = True
elif e.code == libevdev.EV_ABS.ABS_MT_POSITION_X:
if s.state == SlotState.UPDATE:
# If recording started after touch down
if s.state == SlotState.NONE:
s.state = SlotState.BEGIN
s.dx, s.dy = 0, 0
elif s.state == SlotState.UPDATE:
s.dx = e.value - s.x
s.x = e.value
s.dirty = True
elif e.code == libevdev.EV_ABS.ABS_MT_POSITION_Y:
if s.state == SlotState.UPDATE:
# If recording started after touch down
if s.state == SlotState.NONE:
s.state = SlotState.BEGIN
s.dx, s.dy = 0, 0
elif s.state == SlotState.UPDATE:
s.dy = e.value - s.y
s.y = e.value
s.dirty = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment