Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set cursor position in Mac OS

I want to write a little vnc similar program that moves the Mac OS cursor to a position (x, y) given through a protocol which gets data from Bonjour service. The problem is that I don't know how to move the cursor!

I'm working with Cocoa.

like image 306
Pascal Bayer Avatar asked Aug 25 '10 22:08

Pascal Bayer


People also ask

How do you recalibrate a cursor on a Mac?

Click on the "Keyboard and Mouse" option and select the "Trackpad" tab to access trackpad settings. Look at the tracking speed and double-click speed sliders to ensure that the pointer is set somewhere in the middle, between the Slow and Fast options.

How do I get the cursor positioned on my screen?

Go to the 'Pointer Options' tab. 5. At the bottom of the window, check mark 'Show Location of Pointer when I press the CTRL key'.

How do I customize my Mac cursor?

On your Mac, use the Pointer pane of Accessibility Display preferences to change the size and color of the pointer to make it easier to find on the screen. To change these preferences, choose Apple menu > System Preferences, click Accessibility , click Display, then click Pointer.

How do I change my cursor on my Mac 2022?

Launch System Preferences from your Mac's Dock, from the Applications folder, or from the Apple menu bar ( -> System Preferences...). Click the Accessibility preference pane. In the side column, under "Vision," click Display. Click the Pointer tab in the window of options.


1 Answers

You can be forgiven for not looking in Quartz Display Services for this one. The function you're after is CGWarpMouseCursorPosition.

Since the documentation doesn't say, you'll have to experiment to determine which co-ordinate system it uses—i.e., where the origin is and which way positive y goes.

like image 124
Peter Hosey Avatar answered Oct 05 '22 19:10

Peter Hosey