How to store (and use) the current mouse position?

Posted by Ben Packard on Stack Overflow See other posts from Stack Overflow or by Ben Packard
Published on 2010-01-24T09:57:26Z Indexed on 2010/05/04 1:38 UTC
Read the original article Hit count: 320

Filed under:
|
|
|
|

What is the best way to store the current mouse position (system-wide) and then (later) put the mouse at that stored point?

[NSEvent mouseLocation] gets me the position, and I can move the mouse with a CGEventMouseMoved, but they each use a different co-ordinates system (I believe y=0 is the top for NSEvent and the bottom for a CGEvent).

I'm worried about the robustness of capturing the screen height and using it to convert between the two - or is this the best approach?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsevent