diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-02-16 18:07:57 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-02-16 18:07:57 +0100 |
| commit | 7864e778cc10dbc2b0064f0f1953ef5389f0d68b (patch) | |
| tree | 6d3505d33fdf0448a8c7ea8dbddc52a75b7abbfc /tools/utouch-frame-test-xi2.c | |
| parent | 9394c8edc39063f4462bbfedbd4225f6c1aebc98 (diff) | |
Break out common display functions
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'tools/utouch-frame-test-xi2.c')
| -rw-r--r-- | tools/utouch-frame-test-xi2.c | 67 |
1 files changed, 3 insertions, 64 deletions
diff --git a/tools/utouch-frame-test-xi2.c b/tools/utouch-frame-test-xi2.c index df68c1a..015c119 100644 --- a/tools/utouch-frame-test-xi2.c +++ b/tools/utouch-frame-test-xi2.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <unistd.h> | 30 | #include <unistd.h> |
| 31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
| 32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
| 33 | #include "common-defs.h" | ||
| 33 | 34 | ||
| 34 | static int opcode; | 35 | static int opcode; |
| 35 | 36 | ||
| @@ -91,68 +92,6 @@ static void destroy_all(struct frame_test *test) | |||
| 91 | memset(test, 0, sizeof(*test)); | 92 | memset(test, 0, sizeof(*test)); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | static void report_device_caps(struct frame_test *test) | ||
| 95 | { | ||
| 96 | struct utouch_surface *s = utouch_frame_get_surface(test->fh); | ||
| 97 | fprintf(stderr, "device props:\n"); | ||
| 98 | if (s->needs_pointer) | ||
| 99 | fprintf(stderr, "\tpointer\n"); | ||
| 100 | if (s->is_direct) | ||
| 101 | fprintf(stderr, "\tdirect\n"); | ||
| 102 | if (s->is_buttonpad) | ||
| 103 | fprintf(stderr, "\tbuttonpad\n"); | ||
| 104 | if (s->is_semi_mt) | ||
| 105 | fprintf(stderr, "\tsemi_mt\n"); | ||
| 106 | fprintf(stderr, "device mt events:\n"); | ||
| 107 | if (s->use_touch_major) | ||
| 108 | fprintf(stderr, "\ttouch_major\n"); | ||
| 109 | if (s->use_touch_minor) | ||
| 110 | fprintf(stderr, "\ttouch_minor\n"); | ||
| 111 | if (s->use_width_major) | ||
| 112 | fprintf(stderr, "\twidth_major\n"); | ||
| 113 | if (s->use_width_minor) | ||
| 114 | fprintf(stderr, "\twidth_minor\n"); | ||
| 115 | if (s->use_orientation) | ||
| 116 | fprintf(stderr, "\torientation\n"); | ||
| 117 | if (s->use_pressure) | ||
| 118 | fprintf(stderr, "\tpressure\n"); | ||
| 119 | if (s->use_distance) | ||
| 120 | fprintf(stderr, "\tdistance\n"); | ||
| 121 | } | ||
| 122 | |||
| 123 | static void report_frame(const struct utouch_frame *frame, | ||
| 124 | const XIDeviceEvent *ev) | ||
| 125 | { | ||
| 126 | int i; | ||
| 127 | |||
| 128 | for (i = 0; i < frame->num_active; i++) { | ||
| 129 | const struct utouch_contact *t = frame->active[i]; | ||
| 130 | |||
| 131 | fprintf(stderr, "touch %d\n", i); | ||
| 132 | fprintf(stderr, " slot: %d\n", t->slot); | ||
| 133 | fprintf(stderr, " id: %d\n", t->id); | ||
| 134 | fprintf(stderr, " tool_type: %d\n", t->tool_type); | ||
| 135 | fprintf(stderr, " x: %f\n", t->x); | ||
| 136 | fprintf(stderr, " y: %f\n", t->y); | ||
| 137 | fprintf(stderr, " touch_major: %f\n", t->touch_major); | ||
| 138 | fprintf(stderr, " touch_minor: %f\n", t->touch_minor); | ||
| 139 | fprintf(stderr, " width_major: %f\n", t->width_major); | ||
| 140 | fprintf(stderr, " width_minor: %f\n", t->width_minor); | ||
| 141 | fprintf(stderr, " angle: %f\n", t->orientation); | ||
| 142 | fprintf(stderr, " pressure: %f\n", t->pressure); | ||
| 143 | fprintf(stderr, " distance: %f\n", t->distance); | ||
| 144 | } | ||
| 145 | |||
| 146 | fprintf(stderr, "sync %d %ld %d %d %d %f %f\n", | ||
| 147 | frame->num_active, | ||
| 148 | frame->time, | ||
| 149 | frame->sequence_id, | ||
| 150 | frame->revision, | ||
| 151 | frame->slot_revision, | ||
| 152 | ev->root_x, | ||
| 153 | ev->root_y); | ||
| 154 | } | ||
| 155 | |||
| 156 | static void handle_event(struct frame_test *test, XEvent *ev) | 95 | static void handle_event(struct frame_test *test, XEvent *ev) |
| 157 | { | 96 | { |
| 158 | XGenericEventCookie *gev = &ev->xcookie; | 97 | XGenericEventCookie *gev = &ev->xcookie; |
| @@ -175,7 +114,7 @@ static void handle_event(struct frame_test *test, XEvent *ev) | |||
| 175 | if (gev->type == GenericEvent && gev->extension == opcode) { | 114 | if (gev->type == GenericEvent && gev->extension == opcode) { |
| 176 | frame = utouch_frame_pump_xi2(test->fh, dev); | 115 | frame = utouch_frame_pump_xi2(test->fh, dev); |
| 177 | if (frame) | 116 | if (frame) |
| 178 | report_frame(frame, dev); | 117 | report_frame(frame); |
| 179 | } | 118 | } |
| 180 | XFreeEventData(test->display, gev); | 119 | XFreeEventData(test->display, gev); |
| 181 | break; | 120 | break; |
| @@ -229,7 +168,7 @@ int main(int argc, char *argv[]) | |||
| 229 | return -1; | 168 | return -1; |
| 230 | } | 169 | } |
| 231 | 170 | ||
| 232 | report_device_caps(&test); | 171 | report_device_caps(test.fh); |
| 233 | 172 | ||
| 234 | loop_device(&test); | 173 | loop_device(&test); |
| 235 | 174 | ||
