在Mac OS中设置光标位置 [英] Set cursor position in Mac OS
问题描述
我想写一个小vnc类似程序,将Mac OS光标移动到通过从Bonjour服务获取数据的协议给出的位置(x,y)。问题是,我不知道如何移动光标!
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!
我正在使用Cocoa。
I'm working with Cocoa.
推荐答案
你可以原谅不看Quartz显示服务这一个。您之后的函数是 CGWarpMouseCursorPosition
。
You can be forgiven for not looking in Quartz Display Services for this one. The function you're after is CGWarpMouseCursorPosition
.
由于文档没有说,必须进行实验,以确定它使用哪个坐标系统,即原点在哪里以及y的正向。
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.
这篇关于在Mac OS中设置光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!