Re: How to programmatically detect that Mission Control is running?
Re: How to programmatically detect that Mission Control is running?
- Subject: Re: How to programmatically detect that Mission Control is running?
- From: Ken Thomases <email@hidden>
- Date: Tue, 23 Oct 2012 22:22:52 -0500
On Oct 22, 2012, at 1:05 AM, Daiwei Li wrote:
>> You should rely on key repeat events to let you know that you need to
>> continue to respond to the key press. For mouse events, you should request
>> periodic events.
>
> Could you point me towards the APIs that let me get key repeat and periodic
> mouse events?
So long as a key is held down, your app will continue to receive NSKeyDown events. -[NSEvent isARepeat] returns TRUE for the repeat events.
You don't get periodic mouse events. You can request to receive NSPeriodic events. That's the standard way of continuing to do some action for as long as the mouse button is held down. The canonical example from the docs is now outdated, but it was clicking on the arrow at the end of a scroll bar. Assuming the user doesn't move the mouse while holding the button down, there would not normally be a continuing stream of events to cause scrolling to continue for the duration. So, the app should request periodic events so long as the mouse is down inside the button.
For the key repeat events, I strongly suspect you will stop receiving those when Mission Control activates. I'm less sure about the periodic events. Although if you keep receiving those, you can probably check if the mouse is still on/over your app's control. Perhaps using +[NSWindow windowNumberAtPoint:belowWindowWithWindowNumber:].
Regards,
Ken
_______________________________________________
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