1

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?

asked Nov 8, 2013 at 16:25
1
  • It depends if you are thinking of some X11 based desktop application or not. Commented Nov 8, 2013 at 16:51

1 Answer 1

3

There are two methods:

  1. 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.

  2. 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.

answered Nov 8, 2013 at 17:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.