Problem with touchscreen events and grabs

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 15 20:09:53 PDT 2012


On Fri, Oct 12, 2012 at 03:38:24PM +0200, Thierry Reding wrote:
> Hi,
> 
> I've been seeing a very strange issue. Originally this was observed when
> using a browser with an onscreen keyboard. It would sometimes happen
> that the keys on the keyboard would get stuck and be repeatedly sent.
> 
> While trying to debug this, I came across a reliable way to reproduce it
> using xwininfo. Basically I would run xwininfo and select the onscreen
> keyboard. This would immediately result in the key being pressed and not
> receiving a release event. Using other keys on the onscreen keyboard
> would make them pressed as well, but never released either, resulting in
> repeated keypresses received by the browser. It seems like X for some
> reason believes that the press event is actually a release and vice-
> versa.
> 
> In order to find out what exactly was going on, I fired up xev with the
> window XID as reported by xwininfo. This would indeed show the repeated
> key events sent to the onscreen keyboard's window. Strangely enough, if
> xev is started without an existing window XID, generating touch events
> in that window seems to "fix" the issue. The keyboard can be used
> reliably again.
> 
> Furthermore, when running xwininfo and selecting the onscreen keyboard,
> a second call to xwininfo would fail, saying it cannot grab the mouse.
> This issue can be reliably reproduced independent of the onscreen
> keyboard and works with any X window. So opening an xterm for instance,
> then running xwininfo and selecting xterm will cause any subsequent
> calls to xwininfo to fail. Running xev and generating touch events in
> its window again fixes things.
> 
> It seems like the X server doesn't properly release the grab and gets
> the touch down and up events mixed up. Note that all of this only
> happens when using a touchscreen device. Performing the same tests using
> a regular USB mouse to select the X window for xwininfo doesn't show the
> same behaviour.
> 
> I'm using version 1.13 of the X server and xf86-input-evdev 2.7.3. Can
> anybody else reproduce this?
> 
> If you need any more information I'd be happy to provide it.

Can you reproduce this with xinput -- test-xi2 and check what happens to the
touch events? In particular the raw events.
Also try to compile your server with the dtrace hooks enabled and look at
c0b0a9bce9237b0abe150c1a7b54939affecc751 for a example systemtap script.
That should tell you what events the driver submits to the server.

But on the whole, this issue looks convoluted enough that you may have to
write a little test application to reliably reproduce this.

Cheers,
   Peter





More information about the xorg-devel mailing list