[PATCH libinput 04/11] test: allow nesting of litest_push_event_frame()
Peter Hutterer
peter.hutterer at who-t.net
Mon Jan 30 00:58:40 UTC 2017
Right now, we fail if we call litest_push_event_frame() when already inside a
frame. For the semi-mt handling we need to do exactly that though, so turn it
into a counting semaphore instead.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/litest.c | 13 ++++++++-----
test/litest.h | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/test/litest.c b/test/litest.c
index 21afaf9..3bc58d9 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1384,6 +1384,8 @@ litest_delete_device(struct litest_device *d)
if (!d)
return;
+ litest_assert_int_eq(d->skip_ev_syn, 0);
+
libinput_device_unref(d->libinput_device);
libinput_path_remove_device(d->libinput_device);
if (d->owns_context)
@@ -3042,16 +3044,17 @@ litest_timeout_trackpoint(void)
void
litest_push_event_frame(struct litest_device *dev)
{
- litest_assert(!dev->skip_ev_syn);
- dev->skip_ev_syn = true;
+ litest_assert(dev->skip_ev_syn >= 0);
+ dev->skip_ev_syn++;
}
void
litest_pop_event_frame(struct litest_device *dev)
{
- litest_assert(dev->skip_ev_syn);
- dev->skip_ev_syn = false;
- litest_event(dev, EV_SYN, SYN_REPORT, 0);
+ litest_assert(dev->skip_ev_syn > 0);
+ dev->skip_ev_syn--;
+ if (dev->skip_ev_syn == 0)
+ litest_event(dev, EV_SYN, SYN_REPORT, 0);
}
static void
diff --git a/test/litest.h b/test/litest.h
index 886337b..60757dc 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -270,7 +270,7 @@ struct litest_device {
struct litest_device_interface *interface;
int ntouches_down;
- bool skip_ev_syn;
+ int skip_ev_syn;
void *private; /* device-specific data */
};
--
2.9.3
More information about the wayland-devel
mailing list