Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Intercept and generate keyboard & mouse events?

Intercept and generate keyboard & mouse events?
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2002
Location: San Francsico, CA
Status: Offline
Reply With Quote
Aug 28, 2002, 05:53 PM
 
I'm interested in writing an application that will intercept keyboard & mouse events, and will then be able to generate new keyboard & mouse events based upon what it observes. For example, adding gesture recognition to my iBook's touchpad: when the Control key (or some other hot key) is pressed down, I'd like certain mouse gestures to generate GUI events such as key presses, etc. Maybe even extend it to something similar to Graffiti on Palm Pilots. I don't want this to be limited to a single application, but I'd like the gestures to work while I'm running any arbitrary app. I'm hoping this will allow me to extend the abilities of my iBook's built in trackpad.

I've seen that bits & pieces of this can be done. Gamepad Companion will generate keyboard and mouse events based upon USB gamepad input, so event generation is at least possible (I suspect via a CoreGraphics method). What I don't know how to do is intercept keyboard & mouse events. Ideally I could somehow hook myself into the event processing chain, and choose to filter out events when I desire (like filtering out mouse movement while the hotkey is pressed). However, I'd settle for just being able to observe them. I've seen discussion of NSEvent stuff, but that seems to only allow overriding the behavior within an individual app or widget, not allow me to watch events globally.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Aug 28, 2002, 06:25 PM
 
You'd need to write a driver that interfaces with IOKit/HID, or something.
     
Forum Regular
Join Date: Aug 2001
Location: Vienna, Austria
Status: Offline
Reply With Quote
Aug 30, 2002, 06:06 AM
 
Originally posted by switched:
Gamepad Companion will generate keyboard and mouse events based upon USB gamepad input, so event generation is at least possible (I suspect via a CoreGraphics method).
yep, CGRemoteOperation (see header)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:42 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2