If libinput replay is currently replaying events, stop that sequence and
go back to the start if the user presses Ctrl+C. Only on the second
Ctrl+C do we fully exit.
This helps debugging long recordings where we don't want to keep
producing events after some initial event sequence.
Closes #1064
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
else:
input("Hit enter to start replaying")
- processes = []
- for d in devices:
- p = multiprocessing.Process(target=wrap, args=(replay, d, args.verbose))
- processes.append(p)
+ try:
+ processes = []
+ for d in devices:
+ p = multiprocessing.Process(target=wrap, args=(replay, d, args.verbose))
+ processes.append(p)
- for p in processes:
- p.start()
+ for p in processes:
+ p.start()
- for p in processes:
- p.join()
+ for p in processes:
+ p.join()
- del processes
+ del processes
- if args.once:
- break
+ if args.once:
+ break
+ except KeyboardInterrupt:
+ print("Event replay interrupted, press Ctrl+C again to exit.")
+ print("Note that the device may not be in a neutral state now.")
def create_device_quirk(device):