On Tue, May 15, 2012 at 01:21:55PM -0700, Chase Douglas wrote: > Otherwise: > > * We can't end the touches while device is disabled > * New touches after enabling the device may erroneously be mapped to old > logical touches > > Signed-off-by: Chase Douglas <chase.doug...@canonical.com> > --- > dix/devices.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/dix/devices.c b/dix/devices.c > index 7f38865..8a60cfd 100644 > --- a/dix/devices.c > +++ b/dix/devices.c > @@ -415,6 +415,31 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) > > > /** > + * End physically active touches for a device. > + */ > +static void > +EndPhysicallyActiveTouches(DeviceIntPtr dev) > +{ > + InternalEvent *eventlist = InitEventList(GetMaximumEventsNum()); > + int i; > + > + for (i = 0; i < dev->last.num_touches; i++) { > + DDXTouchPointInfoPtr ddxti = dev->last.touches + i; > + > + if (ddxti->active) { > + int j; > + int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id, > + XI_TouchEnd, 0, NULL); > + > + for (j = 0; j < nevents; j++) > + mieqProcessDeviceEvent(dev, eventlist + j, NULL); > + } > + } > + > + FreeEventList(eventlist, GetMaximumEventsNum()); > +} > +
you'll need to OsBlockSignals() because you may still get events and that may have funky side-effects. Should be taken care of by the callers but it's still better to add it here too. Also, can we move this into dix/touch.c please (including "Touch" prefix)? that's what that file is for. Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> otherwise. Cheers, Peter > +/** > * Switch a device off through the driver and push it onto the off_devices > * list. A device will not send events while disabled. All clients are > * notified about the device being disabled. > @@ -437,6 +462,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) > if (*prev != dev) > return FALSE; > > + EndPhysicallyActiveTouches(dev); > ReleaseButtonsAndKeys(dev); > SyncRemoveDeviceIdleTime(dev->idle_counter); > dev->idle_counter = NULL; > -- > 1.7.9.5 > _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel