diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2011-01-07 19:01:32 +0100 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2011-01-07 19:01:32 +0100 |
commit | 46f4b2b686959eda144748d5a7416716256a7d50 (patch) | |
tree | c47f950171fd0851b9b6f449de666529bd4bfd27 | |
parent | 51a5b7aa634daeac4f54ad0c6d4a15555d90447d (diff) |
closer
-rw-r--r-- | tools/utouch-frame-test-xi2.c | 98 |
1 files changed, 69 insertions, 29 deletions
diff --git a/tools/utouch-frame-test-xi2.c b/tools/utouch-frame-test-xi2.c index eb19eb7..b896b26 100644 --- a/tools/utouch-frame-test-xi2.c +++ b/tools/utouch-frame-test-xi2.c @@ -70,6 +70,35 @@ static void destroy_all(struct frame_test *test) memset(test, 0, sizeof(*test)); } +static void report_device_caps(struct frame_test *test) +{ + struct utouch_surface *s = utouch_frame_get_surface(test->fh); + fprintf(stderr, "device props:\n"); + if (s->needs_pointer) + fprintf(stderr, "\tpointer\n"); + if (s->is_direct) + fprintf(stderr, "\tdirect\n"); + if (s->is_buttonpad) + fprintf(stderr, "\tbuttonpad\n"); + if (s->is_semi_mt) + fprintf(stderr, "\tsemi_mt\n"); + fprintf(stderr, "device mt events:\n"); + if (s->use_touch_major) + fprintf(stderr, "\ttouch_major\n"); + if (s->use_touch_minor) + fprintf(stderr, "\ttouch_minor\n"); + if (s->use_width_major) + fprintf(stderr, "\twidth_major\n"); + if (s->use_width_minor) + fprintf(stderr, "\twidth_minor\n"); + if (s->use_orientation) + fprintf(stderr, "\torientation\n"); + if (s->use_pressure) + fprintf(stderr, "\tpressure\n"); + if (s->use_distance) + fprintf(stderr, "\tdistance\n"); +} + static void report_frame(const struct utouch_frame *frame) { int i; @@ -103,6 +132,46 @@ static void report_frame(const struct utouch_frame *frame) static void loop_device(struct frame_test *test) { const struct utouch_frame *frame; + XIEventMask mask; + XEvent ev; + Window win = DefaultRootWindow(test->display); + + XSelectInput(test->display, win, ExposureMask); + XMaskEvent(test->display, ExposureMask, &ev); + XSelectInput(test->display, win, 0); + + memset(mask.mask, 0, mask.mask_len); + XISetMask(mask.mask, XI_TouchBegin); + XISetMask(mask.mask, XI_TouchMotion); + XISetMask(mask.mask, XI_TouchEnd); + XISelectEvents(test->display, win, &mask, 1); + + XMapWindow(test->display, win); + XSync(test->display, False); + + while (1) { + XGenericEventCookie *cookie = &ev.xcookie; + XNextEvent(test->display, &ev); + + fprintf(stderr, "ev %d %d\n", + cookie->extension, cookie->evtype); + + if (XGetEventData(test->display, cookie) && + cookie->type == GenericEvent) { + fprintf(stderr, "type %d %d\n", + cookie->extension, cookie->evtype); + switch (cookie->evtype) { + case XI_TouchBegin: + break; + case XI_TouchMotion: + break; + case XI_TouchEnd: + break; + } + } + XFreeEventData(test->display, cookie); + } + #if 0 while (!mtdev_idle(test->mtdev, fd, 5000)) { while (mtdev_get(test->mtdev, fd, &ev, 1) > 0) { @@ -114,35 +183,6 @@ static void loop_device(struct frame_test *test) #endif } -static void report_device_caps(struct frame_test *test) -{ - struct utouch_surface *s = utouch_frame_get_surface(test->fh); - fprintf(stderr, "device props:\n"); - if (s->needs_pointer) - fprintf(stderr, "\tpointer\n"); - if (s->is_direct) - fprintf(stderr, "\tdirect\n"); - if (s->is_buttonpad) - fprintf(stderr, "\tbuttonpad\n"); - if (s->is_semi_mt) - fprintf(stderr, "\tsemi_mt\n"); - fprintf(stderr, "device mt events:\n"); - if (s->use_touch_major) - fprintf(stderr, "\ttouch_major\n"); - if (s->use_touch_minor) - fprintf(stderr, "\ttouch_minor\n"); - if (s->use_width_major) - fprintf(stderr, "\twidth_major\n"); - if (s->use_width_minor) - fprintf(stderr, "\twidth_minor\n"); - if (s->use_orientation) - fprintf(stderr, "\torientation\n"); - if (s->use_pressure) - fprintf(stderr, "\tpressure\n"); - if (s->use_distance) - fprintf(stderr, "\tdistance\n"); -} - int main(int argc, char *argv[]) { struct frame_test test; |