mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-01 17:30:09 +01:00
test: add helper functions to filter an event
Simplest implementation for what we need right now, it turns off an event on the evdev device and turns it back on again. This allows us to change bits in the 'normal' event stream, such as changing the tool type without triggering proximity events for the BTN_TOOL_PEN that all test devices send by default. This won't work for absolute devices because we need to re-enable with a struct input_absinfo. But we don't need that ability for now anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
47fbd8f98f
commit
2dd9b77c9d
2 changed files with 29 additions and 0 deletions
|
|
@ -3248,6 +3248,26 @@ litest_pop_event_frame(struct litest_device *dev)
|
|||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
}
|
||||
|
||||
void
|
||||
litest_filter_event(struct litest_device *dev,
|
||||
unsigned int type,
|
||||
unsigned int code)
|
||||
{
|
||||
libevdev_disable_event_code(dev->evdev, type, code);
|
||||
}
|
||||
|
||||
void
|
||||
litest_unfilter_event(struct litest_device *dev,
|
||||
unsigned int type,
|
||||
unsigned int code)
|
||||
{
|
||||
/* would need an non-NULL argument for re-enabling, so simply abort
|
||||
* until we need to be more sophisticated */
|
||||
litest_assert(type != EV_ABS);
|
||||
|
||||
libevdev_enable_event_code(dev->evdev, type, code, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
send_abs_xy(struct litest_device *d, double x, double y)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -707,6 +707,15 @@ litest_push_event_frame(struct litest_device *dev);
|
|||
void
|
||||
litest_pop_event_frame(struct litest_device *dev);
|
||||
|
||||
void
|
||||
litest_filter_event(struct litest_device *dev,
|
||||
unsigned int type,
|
||||
unsigned int code);
|
||||
|
||||
void
|
||||
litest_unfilter_event(struct litest_device *dev,
|
||||
unsigned int type,
|
||||
unsigned int code);
|
||||
void
|
||||
litest_semi_mt_touch_down(struct litest_device *d,
|
||||
struct litest_semi_mt *semi_mt,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue