mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 15:50:07 +01:00
tools: libinput-record: move the event time offset to the first place we get it
Leftover from a previous version where printing and handling an event was identical. Now we may handle events but not actually print them until a bit later, so other events may have a (wrong) zero timestamp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1392c1f3ac
commit
d140bb7c2d
1 changed files with 3 additions and 2 deletions
|
|
@ -193,8 +193,6 @@ print_evdev_event(struct record_context *ctx, struct input_event *ev)
|
|||
bool was_modified = false;
|
||||
char desc[1024];
|
||||
|
||||
if (ctx->offset == 0)
|
||||
ctx->offset = tv2us(&ev->time);
|
||||
ev->time = us2tv(tv2us(&ev->time) - ctx->offset);
|
||||
|
||||
/* Don't leak passwords unless the user wants to */
|
||||
|
|
@ -269,6 +267,9 @@ handle_evdev_frame(struct record_context *ctx, struct record_device *d)
|
|||
LIBEVDEV_READ_FLAG_NORMAL,
|
||||
&e) == LIBEVDEV_READ_STATUS_SUCCESS) {
|
||||
|
||||
if (ctx->offset == 0)
|
||||
ctx->offset = tv2us(&e.time);
|
||||
|
||||
if (d->nevents == d->events_sz)
|
||||
resize(d->events, d->events_sz);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue