Skip to content

tools/debug-events: add ability to compress motion events

Peter Hutterer requested to merge whot/libinput:wip/debug-events-filter into main

If --compress-motion-events (and stdout is a tty) is given reduce the output printed to one line per repeated motion/axis/scroll sequence (with a count). Example output:

 event6   POINTER_MOTION          108 +1.912s	 1.00/ -1.00 ( +1.00/ -1.00))
 event6   POINTER_BUTTON              +2.008s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_BUTTON              +2.074s	BTN_LEFT (272) released, seat count: 0
 event6   POINTER_MOTION           39 +5.249s	 0.00/  0.99 ( +0.00/ +1.00)
 event6   POINTER_BUTTON              +5.385s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_MOTION           66 +6.031s	-1.00/  0.00 ( -1.00/ +0.00)
 event6   POINTER_BUTTON              +6.401s	BTN_LEFT (272) released, seat count: 0

The event count (108, 39 and 66) is only printed for more than one event in sequence so the output is otherwise identical (but 4 spaces wider now)

If stdout is not a tty the event count is printed but no compression happens since we rely on a ansi escape sequence for that. Could be fixed by changing the current print statements to print a \n before the current event instead of at the end of the current line.

This makes debugging events easier as button events and similar are no longer obscured by pages of motion events in between.


Not super happy about the commandline flag name but can't think of anything better.

Merge request reports