test: Add a common helper function to drain all current events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-01-22 11:20:50 +10:00
parent 09a3770961
commit 4ec24b2037
2 changed files with 13 additions and 0 deletions

View file

@ -461,3 +461,15 @@ int litest_scale(const struct litest_device *d, unsigned int axis, int val)
max = d->interface->max[axis];
return (max - min) * val/100.0 + min;
}
void
litest_drain_events(struct libinput *li)
{
struct libinput_event *event;
libinput_dispatch(li);
while ((event = libinput_get_event(li))) {
libinput_event_destroy(event);
libinput_dispatch(li);
}
}

View file

@ -90,5 +90,6 @@ void litest_touch_move_to(struct litest_device *d,
void litest_button_click(struct litest_device *d,
unsigned int button,
bool is_press);
void litest_drain_events(struct libinput *li);
#endif /* LITEST_H */