summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-06-03 16:21:10 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-06-04 10:43:33 +1000
commit9b3e0e8043f8b1f8d6d1ea22556441d73bf8b243 (patch)
tree34a1a4ac5e5c577d35f83d05e4593911312356be /tools
parent9ecac89bab169b76817b19c041ae43ceec2e42b9 (diff)
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 <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/libinput-analyze-per-slot-delta.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/libinput-analyze-per-slot-delta.py b/tools/libinput-analyze-per-slot-delta.py
index 06a79e60..bdafeff1 100755
--- a/tools/libinput-analyze-per-slot-delta.py
+++ b/tools/libinput-analyze-per-slot-delta.py
@@ -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