diff --git a/Xi/exevents.c b/Xi/exevents.c index 17d751e317ac58ddc14135c9d34178388061e728..659816a4636eb0c4a231fe40aa0c54878253ca4d 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1293,14 +1293,21 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, int rc; InputClients *iclients = NULL; *mask = NULL; + *grab = NULL; if (listener->type == LISTENER_GRAB || listener->type == LISTENER_POINTER_GRAB) { - *grab = listener->grab; BUG_RETURN_VAL(!*grab, FALSE); + } + else if (ti->emulate_pointer && dev->deviceGrab.grab && + !dev->deviceGrab.fromPassiveGrab) { + /* There may be an active pointer grab on the device */ + *grab = dev->deviceGrab.grab; + } + if (*grab) { *client = rClient(*grab); *win = (*grab)->window; *mask = (*grab)->xi2mask; @@ -1357,8 +1364,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, /* if owner selected, oclients is NULL */ *client = oclients ? rClient(oclients) : wClient(*win); } - - *grab = NULL; } return TRUE; @@ -1498,16 +1503,6 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, &mask)) return; - /* There may be a pointer grab on the device */ - if (!grab) { - grab = dev->deviceGrab.grab; - if (grab) { - win = grab->window; - mask = grab->xi2mask; - client = rClient(grab); - } - } - DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client, win, grab, mask); } diff --git a/dix/events.c b/dix/events.c index d3a33ea3f44f40d40d45c036a21a87f4bb88cfe5..b12d731dd1b1984b3fec51a06d1ec14f8714a001 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1573,7 +1573,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) emulate a ButtonRelease here. So pretend the listener already has the end event */ if (grab->grabtype == CORE || grab->grabtype == XI || - !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) { + !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) { mode = XIAcceptTouch; /* NOTE: we set the state here, but * ProcessTouchOwnershipEvent() will still call