summaryrefslogtreecommitdiff
path: root/tools/utouch-frame-test-xi2.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/utouch-frame-test-xi2.c')
-rw-r--r--tools/utouch-frame-test-xi2.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/utouch-frame-test-xi2.c b/tools/utouch-frame-test-xi2.c
index 65adce3..079a6a9 100644
--- a/tools/utouch-frame-test-xi2.c
+++ b/tools/utouch-frame-test-xi2.c
@@ -30,6 +30,8 @@
#include <unistd.h>
#include <fcntl.h>
+static int xi_opcode;
+
struct frame_test {
Display *display;
Window root, win;
@@ -41,11 +43,15 @@ static int init_xi2(struct frame_test *test, int id)
{
Display *dpy;
int ndevices, i;
+ int event, error;
dpy = XOpenDisplay(NULL);
if (!dpy)
return -1;
+ if (!XQueryExtension(dpy, "XInputExtension", &xi_opcode, &event, &error))
+ return -1;
+
test->display = dpy;
test->info = XIQueryDevice(dpy, XIAllDevices, &ndevices);
test->dev = 0;
@@ -158,8 +164,6 @@ static void loop_device(struct frame_test *test)
XISetMask(mask.mask, XI_TouchEnd);
XISelectEvents(test->display, test->win, &mask, 1);
- XSelectInput(test->display, test->win, ExposureMask);
-
while (1) {
XEvent ev;
XIDeviceEvent *event = (void*)&ev;
@@ -167,8 +171,8 @@ static void loop_device(struct frame_test *test)
XNextEvent(test->display, &ev);
if (XGetEventData(test->display, cookie) &&
- cookie->type == GenericEvent) {
- // should have that opcode as well
+ cookie->type == GenericEvent &&
+ cookie->extension == xi_opcode) {
frame = utouch_frame_pump_xi2(test->fh, cookie->data);
if (frame)
report_frame(frame);