mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-21 16:50:42 +01:00
tools: libinput-replay: handle a nonzero offset for the first event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
aca0e3729a
commit
c819b4f956
1 changed files with 7 additions and 0 deletions
|
|
@ -107,6 +107,7 @@ def replay(device, verbose):
|
|||
uinput = device['__uinput']
|
||||
|
||||
offset = time.time()
|
||||
handled_first_event = False
|
||||
|
||||
# each 'evdev' set contains one SYN_REPORT so we only need to check for
|
||||
# the time offset once per event
|
||||
|
|
@ -118,6 +119,12 @@ def replay(device, verbose):
|
|||
|
||||
(sec, usec, evtype, evcode, value) = evdev[0]
|
||||
|
||||
# The first event may have a nonzero offset but we want to replay
|
||||
# immediately regardless.
|
||||
if not handled_first_event:
|
||||
offset -= sec + usec/1.e6
|
||||
handled_first_event = True
|
||||
|
||||
evtime = sec + usec/1e6 + offset
|
||||
now = time.time()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue