Re: CGEventTap Not Receiving Events after some time
Re: CGEventTap Not Receiving Events after some time
- Subject: Re: CGEventTap Not Receiving Events after some time
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 30 Sep 2010 05:01:26 -0400
On Sep 29, 2010, at 3:52 PM, Erik Aigner wrote:
> When I create an event tap with CGEventTapCreate(..) and add it to the runloop everything works as expected.
> However, after some time (I don't know what triggers this) the event tap doesn't receive events anymore, until
> I manually call CGEventTapEnable(..) again.
>
> Any clues what could cause this? Are there any notifications for status changes that i should know about?
The documentation explains that the system automatically shuts down event taps if events come so quickly that they begin to slow the system down. When this happens, the last event you receive will be a kCGEventTapDisabled event. Test every event's event type to see whether it is a kCGEventTapDisabledByTimeout event (as opposed to a kCGEventTapDisabledByUser event, or a real event). If so, immediately re-enable the event tap, if that's what you want to do. (And don't pass this event on to other routines or act on it the way you would act on a real event.)
The documentation is the "Quartz Event Services Reference."
--
Bill Cheeseman - email@hidden
_______________________________________________
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