Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-21 Thread Jens Alfke
On Feb 21, 2010, at 3:05 AM, Vikram Sethi wrote: > Yes, I would agree that it is not generally a good practice. However, there > are certain things that I would like the app to do in a no-window state for > which tapping into the app would make sense. Keep in mind that many users don't really un

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-21 Thread Vikram Sethi
Hi all, Thanks for the prompt responses. As Jesper mentioned, I would like my app to work on 10.5 as well. I forgot to mention that in my earlier mail. >> "Ordinarily it doesn't make any sense to type into an app that has no open windows. If you have special hot keys that should do something eve

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Jesper Storm Bache
Your comment only pertains to the addGlobal... You can use addLocalMonitor to only snoop on events in your process. From the header: = Use +addLocal to install an event monitor that receives events before they are dispatched by -[NSApplication sendEvent:]. In this case, your block should

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Jens Alfke
On Feb 20, 2010, at 3:45 AM, Vikram Sethi wrote: > However, events like keyDown are not handled by the NSApplication class or > its delegate. Ordinarily it doesn't make any sense to type into an app that has no open windows. If you have special hot keys that should do something even in this s

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Uli Kusterer
On 20.02.2010, at 12:53, Tom Davie wrote: > You want NSEvent's > > + (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)*mask* handler:(void > (^)(NSEvent*))*block* > *and* > * > > + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* > (^)(NSEvent*))block Nope, tha

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Tom Davie
You want NSEvent's + (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)*mask* handler:(void (^)(NSEvent*))*block* *and* * + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* (^)(NSEvent*))block Bob * On Sat, Feb 20, 2010 at 11:45 AM, Vikram Sethi wrote: > Hi, >

Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Vikram Sethi
Hi, I am rewriting the event handling mechanism of my app in Cocoa. It is in Carbon as of now. Is there a Cocoa equivant for InstallApplicationEventHandler(), so that I can listen to event at the application level? As I understand, as per the NSResponder chain hierarchy, I can get the events on th