diff --git a/dix/events.c b/dix/events.c index 03ed106ed..31f8d8700 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1513,8 +1513,15 @@ DeactivatePointerGrab(DeviceIntPtr mouse) * all the touches' listener lists. */ for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) { TouchPointInfoPtr ti = mouse->touch->touches + i; - if (ti->active && TouchResourceIsOwner(ti, grab_resource)) + if (ti->active && TouchResourceIsOwner(ti, grab_resource)) { + /* Rejecting will generate a TouchEnd, but we must not + emulate a ButtonRelease here. So pretend the listener + already has the end event */ + if (grab->grabtype == CORE || grab->grabtype == XI || + !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)) + ti->listeners[0].state = LISTENER_HAS_END; TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); + } } TouchRemovePointerGrab(mouse);