Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ranguvar

macrumors 6502
Original poster
Sep 18, 2009
318
2
Hi,

I'd like my app to track mouse movements even if the mouse no longer hovers above the app's window, but for example on the desktop or on other apps. Receiving a -mouseExited call is not enough, I have to know the actual position of the mouse on the screen.
Is this possible using an NSTrackingArea (if so, how)? Or do I have to use something else.

Thanks for any input!
 
Better (but 10.6-only) way:
Code:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMoved handler:^(NSEvent *mouseMovedEvent) {
 //do things with mouseMovedEvent
}];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.