Comment 9 for bug 1015183

Revision history for this message
Martin von Gagern (gagern) wrote :

OK, I believe I now have a good idea as to why the first ButtonPress in xev has state 0x100. This appears to be due to an TouchOwnership event. If ownership changes, such an event is inserted into the queue, so it will always be processed after the BeginTouch event. I wonder how much later it might get processed, but as there appears to be some history, I simply assume everything is all right there. So the TouchBegin arrives, sets state = 0x100, enqueues an Ownership event, and when that arrives, ProcessTouchOwnershipEvent will first run TouchRejected. This in turn will call EmitTouchEnd, but will not update state. Then TouchPuntToNextOwner will replay the history. The ButtonPress core event corresponding to the initial TouchBegin is now delivered with the CURRENT device state, i.e. 0x100.

For source code of TouchRejected, see
http://cgit.freedesktop.org/xorg/xserver/tree/Xi/exevents.c?id=a986f2f30cbe2a00e72ded7315c4951d7703e549#n1210

I haven't come up with a fix yet, as I haven't fully understood this whole ownership and history/replay business here. But I assume that a proper fix would be restoring the state to what it was at the beginning of the history before replaying said history. Input from people more fluent in that code would be greatly appreciated.