summaryrefslogtreecommitdiff
path: root/dix/touch.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-12-15 07:52:28 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-21 14:16:36 +1000
commit3b1e2035cc4740711360c845cfcdff07f7b60558 (patch)
tree333b6e40555448df8ebe40ac3c3ff9097e30d850 /dix/touch.c
parentcd3de8324e8908955a2e4be3000c8ffee8684c68 (diff)
dix: Remove touch grabs if the grab disappears
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'dix/touch.c')
-rw-r--r--dix/touch.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/dix/touch.c b/dix/touch.c
index 9bd07c37c..db0bf334a 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -37,6 +37,7 @@
#include "inpututils.h"
#include "eventconvert.h"
#include "windowstr.h"
+#include "mi.h"
#define TOUCH_HISTORY_SIZE 100
@@ -936,3 +937,46 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
if (!ti)
return;
}
+
+/* As touch grabs don't turn into active grabs with their own resources, we
+ * need to walk all the touches and remove this grab from any delivery
+ * lists. */
+void
+TouchListenerGone(XID resource)
+{
+ TouchPointInfoPtr ti;
+ DeviceIntPtr dev;
+ InternalEvent *events = InitEventList(GetMaximumEventsNum());
+ int i, j, k, nev;
+
+ if (!events)
+ FatalError("TouchListenerGone: couldn't allocate events\n");
+
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (!dev->touch)
+ continue;
+
+ for (i = 0; i < dev->touch->num_touches; i++)
+ {
+ ti = &dev->touch->touches[i];
+ if (!ti->active)
+ continue;
+
+ for (j = 0; j < ti->num_listeners; j++)
+ {
+ if (ti->listeners[j].listener != resource)
+ continue;
+
+ nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch,
+ resource, 0);
+ for (k = 0; k < nev; k++)
+ mieqProcessDeviceEvent(dev, events + k, NULL);
+
+ break;
+ }
+ }
+ }
+
+ FreeEventList(events, GetMaximumEventsNum());
+}