[PULL] plenty of touch fixes, mainly for #56578

Peter Hutterer peter.hutterer at who-t.net
Thu May 9 22:30:35 PDT 2013

I'm not going to even pretend this is understandable, given that the first
patches to fix this issue go back to November last year. And touch grab
handling and pointer emulation is such a beast that I can't get it all in my
head anymore. I've got a bunch of test cases that show the various bugs that
have been fixed in this series and we've had some reasonable testing on this

The biggest issue fixed here (aside from Ubuntu having a stuck grab
approximately as soon as you touch the dash) is a fix for
xorg-server- That sticks the grab pointer into the
touch listener, but that grab may get free'd at any time (ProcUngrab*),
leading to dangling pointers and crashes whenever the touch continues.

One remaining issue: the Nexus 7 still seems to trigger some bug, but I've
been unable to reproduce this and in the meantime having these see wider
testing will be useful.

The following changes since commit 2f1aedcaed8fd99b823d451bf1fb02330c078f67:

  input: print warnings if drivers don't initialize properly (2013-05-10 11:05:00 +1000)

are available in the git repository at:

  git://people.freedesktop.org/~whot/xserver touch-grab-race-condition-56578-v3

for you to fetch changes up to 77d8077d2c5e31a0227185e141db64846761faa1:

  dix: fix cursor refcounting (2013-05-10 14:41:15 +1000)

Peter Hutterer (24):
      Xi: not having an ownership mask does not mean automatic acceptance
      dix: don't prepend an activated passive grab to the listeners
      Xi: if we delivered a TouchEnd to a passive grab, end it
      Xi: update the core listener state if we delivered the touch event
      Xi: fix lookup in ActivateEarlyAccept
      Xi: if a passive async grab is activated from an emulated touch, accept
      Xi: save state for early acceptance
      Xi: when punting to a new owner, always create TouchEnd events
      Xi: use public.processInputProc to replay the touch history
      Xi: Don't emit a TouchEnd event to a frozen device
      dix: move EmitTouchEnd to touch.c
      dix: XAllowEvents() on a touch event means accepting it
      dix: invert a loop condition
      dix: use a tmp variable for the to-be-removed touch listener
      dix: drop DeviceIntRec's activeGrab struct
      dix: use a temporary variable for listeners[0]
      dix: freeing a null grab is a bug, complain if doing so
      dix: AllocGrab can copy if an argument is passed in
      dix: always copy grabs, don't reference them
      dix: remove all listeners when freeing a touch
      Move TouchListenerGone call to CloseDownClient
      Xi: check for HAS_ACCEPTED only for grab listeners
      dix: free the old grab when activating a new grab
      dix: fix cursor refcounting

 Xi/exevents.c      | 119 ++++++++++++++++++++++++++---------------------------
 Xi/ungrdevb.c      |   2 +-
 Xi/ungrdevk.c      |   2 +-
 Xi/xipassivegrab.c |   2 +-
 dix/devices.c      |   4 +-
 dix/dispatch.c     |   1 +
 dix/events.c       |  60 +++++++++++++++++----------
 dix/grabs.c        |  13 ++++--
 dix/touch.c        | 112 +++++++++++++++++++++++++++++++++++++++++--------
 include/dixgrabs.h |   2 +-
 include/eventstr.h |   1 +
 include/input.h    |   2 +
 include/inputstr.h |   2 +-
 13 files changed, 211 insertions(+), 111 deletions(-)

More information about the xorg-devel mailing list