Reputation: 11
I have tried hard to find a C/C++ library to simulate mouse events in Linux, but cannot find one. Can someone suggest an easy library for the same?
Upvotes: 1
Views: 1479
Reputation: 29618
There are two methods:
You can generate "synthetic" events
The mouse buttons are handled very similar to keys on the keyboard, so it should be simple to adapt this code. Note that applications can find out about this by looking at the IsSynthetic
field in the event. Xterm for example ignores synthetic events for security reasons.
You can use the XTEST extension.
This allows sending events with IsSynthetic
set to False
, and hence full simulation, but the extension is normally disabled or restricted.
Upvotes: 3