mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-08 15:18:05 +03:00
Even with the earlier event-tap-callback cleanup fix, revoking Accessibility in System Settings while Lan Mouse was running with an active capture tap could still leave system input wedged — clicks and keypresses silently dropped until the app was force-quit. The reliable fix is to not rely on in-process tap teardown at all. When AX is revoked: - The kernel guarantees an active CGEventTap is dismantled when the owning process exits. - SIGINT+wait on the daemon child (main.rs already does this on GUI exit) drops the daemon's tap and restores the cursor. So: continuously poll AX state (1-second GLib timer, replacing the one-shot grant watcher), and on a revoke transition call `app.quit()`. Input is restored within ~1-2 seconds regardless of capture state — no force-quit required, no stuck cursor, no silently consumed events beyond the brief window until the poller fires. The grant-transition case is preserved: on a 0→1 flip the warning row swaps to its "relaunch required" state, same as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>