[RFC] Multitouch support, step one

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 15 15:02:25 PDT 2010


On Mon, Mar 15, 2010 at 06:34:48PM +0100, Simon Thum wrote:
> Am 15.03.2010 07:56, schrieb Peter Hutterer:
> > XI2 allows devices to change at runtime. Hence a device may add or remove
> > valuators on-the-fly as touchpoints appear and disappear. There is a chance
> > of a race condition here. If a driver decides to add/remove valuators
> > together with the touchpoints, a client that skips events may miss out.
> > e.g. if a DeviceChanged event that removes an axis is followed by one that
> > adds an axis, a client may only take the second one as current, thus
> > thinking the axis was never removed. There is nothing in the XI2 specs that
> > prohibits this. Anyways, adding removing axes together with touchpoints
> > seems superfluous if we use the presence of an axis as indicator for touch.
> > Rather, I think a device should be set up with a fixed number of valuators
> > describing the default maximum number of touchpoints. Additional ones can be
> > added at runtime if necessary.
> I also see the inherent racyness here, but I guess one could work that
> out by a few routines in libXi which support the MT conventions hammered
> out here. For example, a routine which skims through events and helps to
> associate axis labels to events such that races are prevented. I
> wouldn't worry about things not forbidden in the current spec, as MT so
> far seems to involve some constraints on how clients interact with the
> serer anyway.

This is less a libXi issue as more an issue in how clients may handle the
events. It's in fact quite similar to how motion events can be treated.
XIDeviceChangedEvents describe the state of a device as current when the
event was generated. A client that sees multiple events from the same device
in the queue may thus skip to the last one to get the info. Not much you can
do in libXi.

Cheers,
  Peter


More information about the xorg-devel mailing list