Xi: Do not handle ET_TouchOwnership in ProcessTouchEvent

The event struct is different, causing memory corruption on 1.13 and 1.14,

as can be witnessed in https://bugs.freedesktop.org/show_bug.cgi?id=56578

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Maarten Lankhorst 2013-04-09 11:19:07 +02:00 committed by Peter Hutterer
parent dbba50a128
commit 7347f39f94

View File

@ -1223,9 +1223,16 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
* touchpoint if it is pending finish. * touchpoint if it is pending finish.
*/ */
static void static void
ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
TouchOwnershipEvent *ev) DeviceIntPtr dev)
{ {
TouchPointInfoPtr ti = TouchFindByClientID(dev, ev->touchid);
if (!ti) {
DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
dev->name, ev->type, ev->touchid);
return;
}
if (ev->reason == XIRejectTouch) if (ev->reason == XIRejectTouch)
TouchRejected(dev, ti, ev->resource, ev); TouchRejected(dev, ti, ev->resource, ev);
@ -1538,10 +1545,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
if (!t) if (!t)
return; return;
if (ev->any.type == ET_TouchOwnership) touchid = ev->device_event.touchid;
touchid = ev->touch_ownership_event.touchid;
else
touchid = ev->device_event.touchid;
if (type == ET_TouchBegin) { if (type == ET_TouchBegin) {
ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid, ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
@ -1614,19 +1618,13 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
(type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0)) (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0))
return; return;
/* TouchOwnership events are handled separately from the rest, as they TouchCopyValuatorData(&ev->device_event, ti);
* have more complex semantics. */ /* WARNING: the event type may change to TouchUpdate in
if (ev->any.type == ET_TouchOwnership) * DeliverTouchEvents if a TouchEnd was delivered to a grabbing
ProcessTouchOwnershipEvent(dev, ti, &ev->touch_ownership_event); * owner */
else { DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0);
TouchCopyValuatorData(&ev->device_event, ti); if (ev->any.type == ET_TouchEnd)
/* WARNING: the event type may change to TouchUpdate in TouchEndTouch(dev, ti);
* DeliverTouchEvents if a TouchEnd was delivered to a grabbing
* owner */
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0);
if (ev->any.type == ET_TouchEnd)
TouchEndTouch(dev, ti);
}
if (emulate_pointer) if (emulate_pointer)
UpdateDeviceState(dev, &ev->device_event); UpdateDeviceState(dev, &ev->device_event);
@ -1820,10 +1818,14 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
break; break;
case ET_TouchBegin: case ET_TouchBegin:
case ET_TouchUpdate: case ET_TouchUpdate:
case ET_TouchOwnership:
case ET_TouchEnd: case ET_TouchEnd:
ProcessTouchEvent(ev, device); ProcessTouchEvent(ev, device);
break; break;
case ET_TouchOwnership:
/* TouchOwnership events are handled separately from the rest, as they
* have more complex semantics. */
ProcessTouchOwnershipEvent(&ev->touch_ownership_event, device);
break;
case ET_BarrierHit: case ET_BarrierHit:
case ET_BarrierLeave: case ET_BarrierLeave:
ProcessBarrierEvent(ev, device); ProcessBarrierEvent(ev, device);