Xi: Use current device active grab to deliver touch events if any
When Retrieving touch delivery data we need to check if we have an active grab on such device, and in that case use it to delivery events. If we don't do this, when rejecting the touch events in DeactivatePointerGrab, we will end-up in creating an implicit grab that will change the device deviceGrab's state, causing a recursion during TouchEndTouch. Fixes #7 https://bugs.freedesktop.org/show_bug.cgi?id=96536
This commit is contained in:
parent
700505144f
commit
35e5a76cc1
|
@ -1293,14 +1293,21 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
int rc;
|
int rc;
|
||||||
InputClients *iclients = NULL;
|
InputClients *iclients = NULL;
|
||||||
*mask = NULL;
|
*mask = NULL;
|
||||||
|
*grab = NULL;
|
||||||
|
|
||||||
if (listener->type == LISTENER_GRAB ||
|
if (listener->type == LISTENER_GRAB ||
|
||||||
listener->type == LISTENER_POINTER_GRAB) {
|
listener->type == LISTENER_POINTER_GRAB) {
|
||||||
|
|
||||||
*grab = listener->grab;
|
*grab = listener->grab;
|
||||||
|
|
||||||
BUG_RETURN_VAL(!*grab, FALSE);
|
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);
|
*client = rClient(*grab);
|
||||||
*win = (*grab)->window;
|
*win = (*grab)->window;
|
||||||
*mask = (*grab)->xi2mask;
|
*mask = (*grab)->xi2mask;
|
||||||
|
@ -1357,8 +1364,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
/* if owner selected, oclients is NULL */
|
/* if owner selected, oclients is NULL */
|
||||||
*client = oclients ? rClient(oclients) : wClient(*win);
|
*client = oclients ? rClient(oclients) : wClient(*win);
|
||||||
}
|
}
|
||||||
|
|
||||||
*grab = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1498,16 +1503,6 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
&mask))
|
&mask))
|
||||||
return;
|
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,
|
DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
|
||||||
win, grab, mask);
|
win, grab, mask);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user