touchpad: mark which events are currently pending processing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-02-07 13:48:06 +10:00
parent dc13d3ec96
commit b9dda43c04
2 changed files with 15 additions and 0 deletions

View file

@ -151,6 +151,7 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t)
t->state = TOUCH_BEGIN;
tp->nfingers_down++;
assert(tp->nfingers_down >= 1);
tp->queued |= TOUCHPAD_EVENT_MOTION;
}
}
@ -164,6 +165,7 @@ tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t)
t->state = TOUCH_END;
assert(tp->nfingers_down >= 1);
tp->nfingers_down--;
tp->queued |= TOUCHPAD_EVENT_MOTION;
}
static double
@ -203,11 +205,13 @@ tp_process_absolute(struct tp_dispatch *tp,
t->x = e->value;
t->millis = time;
t->dirty = true;
tp->queued |= TOUCHPAD_EVENT_MOTION;
break;
case ABS_MT_POSITION_Y:
t->y = e->value;
t->millis = time;
t->dirty = true;
tp->queued |= TOUCHPAD_EVENT_MOTION;
break;
case ABS_MT_SLOT:
tp->slot = e->value;
@ -270,6 +274,8 @@ tp_post_process_state(struct tp_dispatch *tp, uint32_t time)
t->dirty = false;
}
tp->queued = TOUCHPAD_EVENT_NONE;
}
static void

View file

@ -31,6 +31,13 @@
#define TOUCHPAD_HISTORY_LENGTH 4
enum touchpad_event {
TOUCHPAD_EVENT_NONE = 0,
TOUCHPAD_EVENT_MOTION = (1 << 0),
TOUCHPAD_EVENT_BUTTON_PRESS = (1 << 1),
TOUCHPAD_EVENT_BUTTON_RELEASE = (1 << 2),
};
enum touch_state {
TOUCH_NONE = 0,
TOUCH_BEGIN,
@ -83,6 +90,8 @@ struct tp_dispatch {
double min_factor;
double max_factor;
} accel;
enum touchpad_event queued;
};
#define tp_for_each_touch(_tp, _t) \