mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-08 03:30:14 +01:00
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:
parent
09a3770961
commit
4ec24b2037
2 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue