~oif-team/frame/1.1.4

« back to all changes in this revision

Viewing changes to tools/frame-test-xi2.c

  • Committer: Chase Douglas
  • Date: 2012-08-15 19:05:52 UTC
  • Revision ID: chase.douglas@canonical.com-20120815190552-ul59r06he8a8j7f8
Rename project to simply 'frame'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 *
3
 
 * utouch-frame - Touch Frame Library
 
3
 * frame - Touch Frame Library
4
4
 *
5
5
 * Copyright (C) 2010-2011 Canonical Ltd.
6
6
 *
24
24
 
25
25
#define MTDEV_NO_LEGACY_API
26
26
 
27
 
#include <utouch/frame-xi2.h>
 
27
#include <oif/frame-xi2.h>
28
28
#include <string.h>
29
29
#include <stdio.h>
30
30
#include <unistd.h>
38
38
        Display *display;
39
39
        Window root, win;
40
40
        XIDeviceInfo *info, *dev;
41
 
        utouch_frame_handle fh;
 
41
        oif_frame_handle fh;
42
42
};
43
43
 
44
44
static int init_xi2(struct frame_test *test, int id)
77
77
 
78
78
static int init_frame(struct frame_test *test)
79
79
{
80
 
        test->fh = utouch_frame_new_engine(100, 32, 100);
 
80
        test->fh = oif_frame_new_engine(100, 32, 100);
81
81
        if (!test->fh)
82
82
                return -1;
83
 
        return utouch_frame_init_xi2(test->fh, test->display, test->dev);
 
83
        return oif_frame_init_xi2(test->fh, test->display, test->dev);
84
84
}
85
85
 
86
86
static void destroy_all(struct frame_test *test)
87
87
{
88
 
        utouch_frame_delete_engine(test->fh);
 
88
        oif_frame_delete_engine(test->fh);
89
89
        XIFreeDeviceInfo(test->info);
90
90
        XDestroyWindow(test->display, test->win);
91
91
        XCloseDisplay(test->display);
95
95
static void handle_event(struct frame_test *test, XEvent *ev)
96
96
{
97
97
        XGenericEventCookie *gev = &ev->xcookie;
98
 
        const struct utouch_frame *frame;
 
98
        const struct oif_frame *frame;
99
99
        XConfigureEvent *cev;
100
100
        XIDeviceEvent *dev;
101
101
 
103
103
        case ConfigureNotify:
104
104
                cev = (XConfigureEvent *)ev;
105
105
                if (cev->window == XDefaultRootWindow(cev->display))
106
 
                        utouch_frame_configure_xi2(test->fh, cev);
 
106
                        oif_frame_configure_xi2(test->fh, cev);
107
107
                break;
108
108
        case GenericEvent:
109
109
                if (!XGetEventData(test->display, gev))
112
112
                /* null for some requests, quite odd */
113
113
                dev->display = ev->xany.display;
114
114
                if (gev->type == GenericEvent && gev->extension == opcode) {
115
 
                        frame = utouch_frame_pump_xi2(test->fh, dev);
 
115
                        frame = oif_frame_pump_xi2(test->fh, dev);
116
116
                        if (frame)
117
117
                                report_frame(frame);
118
118
                }
159
159
                fprintf(stderr, "error: could not describe device\n");
160
160
                return -1;
161
161
        }
162
 
        if (!utouch_frame_is_supported_xi2(test.display, test.dev)) {
 
162
        if (!oif_frame_is_supported_xi2(test.display, test.dev)) {
163
163
                fprintf(stderr, "error: unsupported device\n");
164
164
                return -1;
165
165
        }