sourceid in XIRawEvents

Mark Dokter dokter at icg.tugraz.at
Mon Feb 14 02:13:19 PST 2011


On 02/13/2011 11:57 PM, Peter Hutterer wrote:
> On Fri, Feb 11, 2011 at 03:51:39PM +0100, Mark Dokter wrote:
>> I noticed that the sourceid field in XIRawEvents is 0 while the
>> XIDeviceEvent sourceid field gets filled with the correct id of a slave
>> device.
>> The code I wrote some time ago uses raw events and now I realized that I
>> have the requirement to know from which device the event came from.
>> Is this a bug or is this a deliberate behaviour (since the xinput
>> utility also avoids printing source ids of raw events) ?
> 
> ah, crud. this is a bug in the XI2 spec or the library, depending how you
> see it. the protocol doesn't provide a sourceid. I guess the libXi headers
> have it thanks to a copy/paste bug.

Since you can listen for raw events on the master device, the events
should have source and device ids. If you listen for them on a slave
device, it makes sense, that there should be only one id field.

> 
> Having said that, I can't remember the exact reason why raw events don't
> have a source ID. Other than that the idea of raw events is that you'd be
> listening to the SDs, not the MDs, and thus the need for sourceid isn't
> really there.
> 
Thats too bad. I used the raw events because they provide motion deltas,
so I don't have to calculate them myself, but I listen to master
devices, since I want to work with pointers and not the devices.
When I listen for raw events on the master device, they have the
deviceid of that master device. So there seems to be no other options
than either switching to XIDeviceEvents or listening to each slave device?
What I'm actually trying to achieve is, finding out if the event came
from the xtest slave device or not.

-- 
Mark



More information about the xorg mailing list