开发者

Sending Programmatic Mouse Events to X

开发者 https://www.devze.com 2023-01-30 07:18 出处:网络
I am somewhat new to X development on Linux. I\'m wondering what are best practices (or links to resourc开发者_运维技巧es) for programmatically sending cursor events. Moving the cursor to a normalized

I am somewhat new to X development on Linux. I'm wondering what are best practices (or links to resourc开发者_运维技巧es) 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.


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.


I think you can use XSendEvent. There's some sample code here which uses XQueryPointer to populate most of the event fields.

If you just want to move the pointer, use XWarpPointer.


Also check out xdotool

http://www.semicomplete.com/projects/xdotool/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号