将编程鼠标事件发送到 X
我对 Linux 上的 X
开发有点陌生。我想知道以编程方式发送光标事件的最佳实践(或资源链接)是什么。将光标移动到标准化 (X,Y),创建鼠标右键/左键单击等。理想情况下,这将是 C/C++
中的内容。
我已经尝试过 Qt QCursor
但我想知道完成此操作的原始方法。
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++
.
I have played around with the Qt QCursor
but I'd like to know the raw way to accomplish this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你可以使用
XSendEvent
。 这里有一些示例代码使用XQueryPointer
填充大部分事件字段。如果您只想移动指针,请使用
XWarpPointer
< /a>.I think you can use
XSendEvent
. There's some sample code here which usesXQueryPointer
to populate most of the event fields.If you just want to move the pointer, use
XWarpPointer
.如果您想要“原始”方式来完成它,您需要学习 Xlib。
如果您想要更多原始信息,您将需要研究 X 协议。
你问的是非常专业的知识。您应该前往 X.org 邮件列表或 X 相关新闻组。
You need to be learning Xlib if you want the "raw" way to accomplish it.
If you want even MORE raw, you'll want to study the X protocol.
What you're asking about is pretty darn specialized knowledge. You should head over to the X.org mailing lists or X related newsgroups.
另请查看 xdotool
http://www.semicomplete.com/projects/xdotool/
Also check out xdotool
http://www.semicomplete.com/projects/xdotool/