summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2014-01-27 23:33:46 +0100
committerJonas Ådahl <jadahl@gmail.com>2014-01-27 23:35:14 +0100
commitb57656aa9a5b5def9d5e3722416fe48d49606351 (patch)
tree0405df379c33f37a2195aae4c2e292d6e8411f9a
parent3290b78bd644c90ce04961080f78e65ca995c282 (diff)
downloadlibinput-b57656aa9a5b5def9d5e3722416fe48d49606351.tar.gz
evdev: Don't queue touch events when no touch capability is reported
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
-rw-r--r--src/evdev.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 05144f1c..46bd35ae 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -105,31 +105,43 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
device->rel.dy);
device->rel.dx = 0;
device->rel.dy = 0;
- goto handled;
+ break;
case EVDEV_ABSOLUTE_MT_DOWN:
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ break;
+
touch_notify_touch(base,
time,
slot,
li_fixed_from_int(device->mt.slots[slot].x),
li_fixed_from_int(device->mt.slots[slot].y),
LIBINPUT_TOUCH_TYPE_DOWN);
- goto handled;
+ break;
case EVDEV_ABSOLUTE_MT_MOTION:
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ break;
+
touch_notify_touch(base,
time,
slot,
li_fixed_from_int(device->mt.slots[slot].x),
li_fixed_from_int(device->mt.slots[slot].y),
LIBINPUT_TOUCH_TYPE_MOTION);
- goto handled;
+ break;
case EVDEV_ABSOLUTE_MT_UP:
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ break;
+
touch_notify_touch(base,
time,
slot,
0, 0,
LIBINPUT_TOUCH_TYPE_UP);
- goto handled;
+ break;
case EVDEV_ABSOLUTE_TOUCH_DOWN:
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ break;
+
transform_absolute(device, &cx, &cy);
touch_notify_touch(base,
time,
@@ -137,7 +149,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
li_fixed_from_int(cx),
li_fixed_from_int(cy),
LIBINPUT_TOUCH_TYPE_DOWN);
- goto handled;
+ break;
case EVDEV_ABSOLUTE_MOTION:
transform_absolute(device, &cx, &cy);
if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
@@ -153,17 +165,20 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
li_fixed_from_int(cx),
li_fixed_from_int(cy));
}
- goto handled;
+ break;
case EVDEV_ABSOLUTE_TOUCH_UP:
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ break;
+
touch_notify_touch(base,
time,
0, 0, 0, LIBINPUT_TOUCH_TYPE_UP);
- goto handled;
+ break;
+ default:
+ assert(0 && "Unknown pending event type");
+ break;
}
- assert(0 && "Unknown pending event type");
-
-handled:
device->pending_event = EVDEV_NONE;
}
@@ -362,6 +377,9 @@ evdev_process_absolute(struct evdev_device *device,
static inline int
evdev_need_touch_frame(struct evdev_device *device)
{
+ if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
+ return 0;
+
switch (device->pending_event) {
case EVDEV_NONE:
case EVDEV_RELATIVE_MOTION:
@@ -371,11 +389,8 @@ evdev_need_touch_frame(struct evdev_device *device)
case EVDEV_ABSOLUTE_MT_UP:
case EVDEV_ABSOLUTE_TOUCH_DOWN:
case EVDEV_ABSOLUTE_TOUCH_UP:
- return 1;
case EVDEV_ABSOLUTE_MOTION:
- if (device->seat_caps & EVDEV_DEVICE_TOUCH)
- return 1;
- break;
+ return 1;
}
return 0;