}
struct input_event down[] = {
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
}
static struct input_event down[] = {
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 },
static struct input_event move[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
struct input_event up[] = {
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 0 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
}
static struct input_event down[] = {
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
}
static struct input_event down[] = {
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
- { .type = EV_KEY, .code = BTN_TOOL_FINGER, .value = 1 },
- { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
#include "config.h"
#endif
+#include <assert.h>
#include <check.h>
#include <errno.h>
#include <fcntl.h>
return value;
}
+static void
+send_btntool(struct litest_device *d)
+{
+ litest_event(d, EV_KEY, BTN_TOUCH, d->ntouches_down != 0);
+ litest_event(d, EV_KEY, BTN_TOOL_FINGER, d->ntouches_down == 1);
+ litest_event(d, EV_KEY, BTN_TOOL_DOUBLETAP, d->ntouches_down == 2);
+ litest_event(d, EV_KEY, BTN_TOOL_TRIPLETAP, d->ntouches_down == 3);
+ litest_event(d, EV_KEY, BTN_TOOL_QUADTAP, d->ntouches_down == 4);
+ litest_event(d, EV_KEY, BTN_TOOL_QUINTTAP, d->ntouches_down == 5);
+}
void
litest_touch_down(struct litest_device *d, unsigned int slot,
{
struct input_event *ev;
+ assert(++d->ntouches_down > 0);
+
+ send_btntool(d);
+
if (d->interface->touch_down) {
d->interface->touch_down(d, slot, x, y);
return;
{ .type = -1, .code = -1 }
};
+ assert(--d->ntouches_down >= 0);
+
+ send_btntool(d);
+
if (d->interface->touch_up) {
d->interface->touch_up(d, slot);
return;
bool owns_context;
struct libinput_device *libinput_device;
struct litest_device_interface *interface;
+
+ int ntouches_down;
};
struct libinput *litest_create_context(void);