Handle kCGEventTapDisabledByTimeout
If Accessibility permissions are revoked while Jitouch is running, the system UI no longer responds to mouse clicks or key presses. This is due to Jitouch's CGEventTap callback that receives user input events but cannot pass them along due to a lack of permissions. For more about this issue see aaronkollasch#5.
After a delay, the OS normally detects the CGEventTap has timed out and sends a kCGEventTapDisabledByTimeout event to Jitouch's CGEventCallback. However, this event was ignored, allowing Jitouch to continue dropping all mouse and keyboard events.
With this pull request, if CGEventCallback receives a kCGEventTapDisabledByTimeout event, it will trigger Jitouch to remove the CGEventTap and try to create another for 5 minutes, then exit if one still can't be created.
This PR supersedes #2.
See:
- https://developer.apple.com/documentation/coregraphics/1455445-cgeventtapenable
- https://developer.apple.com/documentation/coregraphics/cgeventtype?language=objc
- http://mirror.informatimago.com/next/developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/QuartzEventServicesRef.pdf