summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-11-27 11:21:17 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2013-01-09 12:33:33 +1000
commit9ad0fdb135a1c336771aee1f6eab75a6ad874aff (patch)
treec7bd5019a050be3783456efa3e66621699348d3f /Xi
parent91ab237358c6e33da854914d3de493a9cbea7637 (diff)
input: Record grab pointer in TouchListener
This places a pointer to the grab related to a TouchListener directly in the TouchListener structure rather than hoping to find the grab later on using the resource ID. Passive grabs have resource ID in the resource DB so they can be removed when a client exits, and those resource IDs get copied when activated, but implicit grabs are constructed on-the-fly and have no resource DB entry. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 58fe49363..22bb5639a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1187,7 +1187,6 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
TouchOwnershipEvent *ev)
{
Bool was_owner = (resource == ti->listeners[0].listener);
- void *grab;
int i;
/* Send a TouchEnd event to the resource being removed, but only if they
@@ -1202,11 +1201,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
/* Remove the resource from the listener list, updating
* ti->num_listeners, as well as ti->num_grabs if it was a grab. */
- if (TouchRemoveListener(ti, resource)) {
- if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB,
- serverClient, DixGetAttrAccess) == Success)
- ti->num_grabs--;
- }
+ TouchRemoveListener(ti, resource);
/* If the current owner was removed and there are further listeners, deliver
* the TouchOwnership or TouchBegin event to the new owner. */
@@ -1300,21 +1295,10 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (listener->type == LISTENER_GRAB ||
listener->type == LISTENER_POINTER_GRAB) {
- rc = dixLookupResourceByType((pointer *) grab, listener->listener,
- RT_PASSIVEGRAB,
- serverClient, DixSendAccess);
- if (rc != Success) {
- /* the grab doesn't exist but we have a grabbing listener - this
- * is an implicit/active grab */
- rc = dixLookupClient(client, listener->listener, serverClient,
- DixSendAccess);
- if (rc != Success)
- return FALSE;
-
- *grab = dev->deviceGrab.grab;
- if (!*grab)
- return FALSE;
- }
+
+ *grab = listener->grab;
+
+ BUG_RETURN_VAL(!*grab, FALSE);
*client = rClient(*grab);
*win = (*grab)->window;
@@ -1467,6 +1451,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
*/
l = &ti->listeners[ti->num_listeners - 1];
l->listener = devgrab->resource;
+ l->grab = devgrab;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = LISTENER_POINTER_GRAB;