Commit 29807d1e authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

Input: mt: add input_mt_is_used

This patch extracts the test (slot->frame == mt->frame) so that it can
be used in third party drivers.
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: default avatarHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent af8036dd
...@@ -247,7 +247,7 @@ void input_mt_sync_frame(struct input_dev *dev) ...@@ -247,7 +247,7 @@ void input_mt_sync_frame(struct input_dev *dev)
if (mt->flags & INPUT_MT_DROP_UNUSED) { if (mt->flags & INPUT_MT_DROP_UNUSED) {
for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
if (s->frame == mt->frame) if (input_mt_is_used(mt, s))
continue; continue;
input_mt_slot(dev, s - mt->slots); input_mt_slot(dev, s - mt->slots);
input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
......
...@@ -69,6 +69,12 @@ static inline bool input_mt_is_active(const struct input_mt_slot *slot) ...@@ -69,6 +69,12 @@ static inline bool input_mt_is_active(const struct input_mt_slot *slot)
return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0; return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0;
} }
static inline bool input_mt_is_used(const struct input_mt *mt,
const struct input_mt_slot *slot)
{
return slot->frame == mt->frame;
}
int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
unsigned int flags); unsigned int flags);
void input_mt_destroy_slots(struct input_dev *dev); void input_mt_destroy_slots(struct input_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment