Archives

All posts for the month May, 2011

 

To find a cursor’s position on the screen. All return and NSPoint

-[NSCursor hotSpot]. The hotSpot is the location inside the cursor image of the tip of the arrow.

If you need the mouse position at the time of some event, use -[NSEvent locationInWindow]. 
If you need the mouse position “now” inside some window, use -[NSWindow mouseLocationOutsideOfEventStream].
If you need the mouse position “now” with neither an event nor a window, use +[NSEvent mouseLocation].

This was taken from the Cocoa dev forms.