aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/events.c16
-rw-r--r--xorg-server/dix/inpututils.c30
-rw-r--r--xorg-server/dix/touch.c4
3 files changed, 39 insertions, 11 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 970c420d5..8f207b2da 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1506,11 +1506,27 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
{
GrabPtr grab = mouse->deviceGrab.grab;
DeviceIntPtr dev;
+ Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
mouse->deviceGrab.implicitGrab);
XID grab_resource = grab->resource;
int i;
+ /* If an explicit grab was deactivated, we must remove it from the head of
+ * 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)) {
+ /* 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);
mouse->valuator->motionHintWindow = NullWindow;
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index fee34ef59..c27799030 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -1016,6 +1016,21 @@ xi2mask_free(XI2Mask **mask)
}
/**
+ * Test if the bit for event type is set for this device only.
+ *
+ * @return TRUE if the bit is set, FALSE otherwise
+ */
+Bool
+xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type)
+{
+ BUG_WARN(dev->id < 0);
+ BUG_WARN(dev->id >= mask->nmasks);
+ BUG_WARN(bits_to_bytes(event_type + 1) > mask->mask_size);
+
+ return BitIsOn(mask->masks[dev->id], event_type);
+}
+
+/**
* Test if the bit for event type is set for this device, or the
* XIAllDevices/XIAllMasterDevices (if applicable) is set.
*
@@ -1026,15 +1041,12 @@ xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type)
{
int set = 0;
- BUG_WARN(dev->id < 0);
- BUG_WARN(dev->id >= mask->nmasks);
- BUG_WARN(bits_to_bytes(event_type + 1) > mask->mask_size);
-
- set = ! !BitIsOn(mask->masks[XIAllDevices], event_type);
- if (!set)
- set = ! !BitIsOn(mask->masks[dev->id], event_type);
- if (!set && IsMaster(dev))
- set = ! !BitIsOn(mask->masks[XIAllMasterDevices], event_type);
+ if (xi2mask_isset_for_device(mask, inputInfo.all_devices, event_type))
+ set = 1;
+ else if (xi2mask_isset_for_device(mask, dev, event_type))
+ set = 1;
+ else if (IsMaster(dev) && xi2mask_isset_for_device(mask, inputInfo.all_master_devices, event_type))
+ set = 1;
return set;
}
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index 29ba17194..d890b6227 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -915,6 +915,8 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
ti = TouchFindByClientID(dev, ev->touchid);
if (!ti)
return;
+
+ /* FIXME: missing a bit of code here... */
}
/* As touch grabs don't turn into active grabs with their own resources, we
@@ -987,8 +989,6 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
for (i = 0; i < nev; i++)
mieqProcessDeviceEvent(dev, events + i, NULL);
- ProcessInputEvents();
-
FreeEventList(events, GetMaximumEventsNum());
return nev ? Success : BadMatch;