将程序鼠标事件发送到X [英] Sending Programtic Mouse Events to X
问题描述
我在Linux上进行 X
开发有些新鲜。我想知道什么是最佳实践(或资源链接),用于以编程方式发送游标事件。将光标移动到标准化(X,Y),创建右/左鼠标点击等。理想情况下,这将是 C / C ++
中的一些。
I am somewhat new to X
development on Linux. I'm wondering what are best practices (or links to resources) for programmatically sending cursor events. Moving the cursor to a normalized (X,Y), creating right/left mouse clicks, etc. Ideally this would be something in C/C++
.
我已经玩过Qt QCursor
,但我想知道完成这个的原始方式。
I have played around with the Qt QCursor
but I'd like to know the raw way to accomplish this.
推荐答案
我想你可以使用 XSendEvent
。有一些示例代码这里使用 XQueryPointer
I think you can use XSendEvent
. There's some sample code here which uses XQueryPointer
to populate most of the event fields.
如果您只想移动指针,请使用 XWarpPointer
。
If you just want to move the pointer, use XWarpPointer
.
这篇关于将程序鼠标事件发送到X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!