I would like to programmatically disable mouse & keyboard input temporarily on a mac (using Objective C/C/Unix) & then reenable them.
I would like to programmatically disable mouse & keyboard input temporarily on a mac
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have made a small open source application that allows you to selectively disable keyboards with the
CGEventTapfunction from OS X. It is inside the Carbon Framework, but based on CoreFoundation, so it also works on Lion.As an example you can try my open SourceApp MultiLayout, available here on GitHub.
Basically what you need to do if you want to do it yourself is:
To use it, you need to add the Carbon Framework:
Then create an event tap like this:
To interrupt the events when necessary, use this snippet:
Just set the boolean
dontForwardTapto true, and the events will be stopped.