• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Snarfing Keyboard Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Snarfing Keyboard Events


  • Subject: Snarfing Keyboard Events
  • From: Seth Willits <email@hidden>
  • Date: Sun, 7 Oct 2007 15:17:17 -0700

Howdy,


In my application I need to be able to intercept keyboard events from the entire system. The Carbon path using GetEventMonitorTarget() sorta works except that it fails to intercept events for hot keys setup with RegisterEventHotKey, nor does it catch certain system- handled keyboard shortcuts like Cmd-Shift-3. Another issue is that I also (at times) need to be the sole listener of a particular event. Hot keys work great except that it can have multiple listeners (for example, installing a hot key for Cmd-Shift-3 still allows the system to use it to take a screenshot). So the only option I know to deal with all of these problems is using an event tap.


Creating an event tap is easy and you can filter out events, so it works perfectly for me, though the biggest issue with using it is that either your app has to be running with root access, or "Enable access for assistive devices" must be turned on in Universal Access. I can accept that if it's the law, though I have a feeling it isn't the law because of Snapz.

Snapz certainly doesn't run as root, nor does it spawn a dedicated root-run process, but even with "Enable access for assistive devices" turned off, Snapz can happily capture Cmd-Shift-3 and block the system and other applications from responding to it. Is there any known way to do this? If I Shark Snapz I see it's responding to some CGS method, so I'm reasonably confident it's using entirely private methods, but I'm still curious.

Anyone have any info?


-- Seth Willits



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Snarfing Keyboard Events
      • From: 慧 松本 <email@hidden>
  • Prev by Date: Re: [question] Checking for duplicate entries in NSMutableArray
  • Next by Date: Re: Snarfing Keyboard Events
  • Previous by thread: Re: NSDocument, setFileURL:
  • Next by thread: Re: Snarfing Keyboard Events
  • Index(es):
    • Date
    • Thread