user1292737
user1292737

Reputation: 86

X11 and fake keyboard / mouse events

I want to know as to how do you detect if a key press event or a mouse pointer event has been generated by an (automation like) application like xdotool.

Basically, I am writing an application to check if there is no real mouse or keyboard activity.

In my application I want to flag idle activity only if we don't have real mouse movement or real key press/release on the keyboard.

Any reference regarding this would be great.

I want to do this using pure XLib API.

I don't want to use XCB.

Any extensions such XRecord(which I am currently using to capture events) are fine.

Upvotes: 6

Views: 1796

Answers (1)

DemoRecorder.com
DemoRecorder.com

Reputation: 31

Yes there is a possibility.

All X11-events which are relevant for mouse movements and clicks have a member called send_event.

It is set to True if the event was sent by an application, and False if it was generated by the X-Server, i.e. by a user action.

If Xdotool uses SendEvent for mousclick simulation than you'll be able to detect that using the send_event member.

Upvotes: 3

Related Questions