how to get fake input events to a Xinput2 master device?

Peter Hutterer peter.hutterer at
Sun Nov 23 19:27:53 PST 2008

On Mon, Nov 24, 2008 at 03:43:50AM +0100, Christian Beier wrote:
> Okay, I'm confused now. I understand that I can address some device
> (MD or SD) via XTestFakeDeviceButtonEvent() etc. So I could send fake
> events to a MD I just created (with sth. like xinputs create_master() ).

yeah, as long as you have an MD that isn't connected to a physical device,
you're fine.

> And i know which MD is connected to which event source by keeping track
> of the names i gave them and find the corresponding XDeviceInfo*
> (and therefore id) via sth like find_device_info() in xinput.c. So each
> of my MDs would be connected to one of my event sources.

The problem is if you have one MD that has multiple physical devices
connected. In between the time of you sending the XTest request and the server
processing it, one of the physical devices may have caused an event, thus
causing the MD to change classes. These classes may have different axes, etc.
than what you sent.

example: phys device with an axis range of 0..10, you send a request to move
to 50/50, this would get capped to 10, and then scaled up to screen coords.


More information about the xorg mailing list