tools/record: rework the event printing
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 26 Mar 2021 03:40:21 +0000 (13:40 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 29 Mar 2021 23:02:31 +0000 (09:02 +1000)
commit33b30d463137db6549e0e3208cbd1ce66a492bd3
tree43e9b36aadeb6f395c8255a198f5ec31d5adb741
parentbacf4e5a62d3a243f23b91c18a4cc0816ceeab51
tools/record: rework the event printing

For historical (but not very good) reasons, libinput record printed events
from the first device to the output file (or stdout) and buffered everything
else. On ctrl+c, the other devices' descriptions and the buffered events were
appended to the output file.

This makes the printing code rather complex. Simplify it by giving each device
a separate FILE* - the first device points to the real output file, the others
to a tempfile. On Ctrl+C we just append those tempfiles to the real output
file one-by-one and done.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/libinput-record.c