aboutsummaryrefslogtreecommitdiff
path: root/src/mtouch.h
blob: 70ebd9f74df8a35b7b2277e7aad56f1147f627e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SKHD_MTHOUCH_H
#define SKHD_MTHOUCH_H

struct mt_point;
struct mt_readout;
struct finger;

#define MULTITOUCH_CALLBACK(name) int name(int device, struct finger *data, int num_fingers, double timestamp, int frame)
typedef MULTITOUCH_CALLBACK(multitouch_callback);

typedef void *MTDeviceRef;
typedef int (*MTContactCallbackFunction)(int, struct finger *, int, double, int);

extern MTDeviceRef MTDeviceCreateDefault();
extern void MTRegisterContactFrameCallback(MTDeviceRef, MTContactCallbackFunction);
extern void MTDeviceStart(MTDeviceRef, int);

struct mt_point
{
    float x;
    float y;
};

struct mt_readout
{
    struct mt_point pos;
    struct mt_point vel;
};

struct finger {
    int frame;
    double timestamp;
    int identifier, state, foo3, foo4;
    struct mt_readout normalized;
    float size;
    int zero1;
    float angle, major_axis, minor_axis;
    struct mt_readout mm;
    int zero2[2];
    float unk2;
};

struct cached_finger_data
{
    int id;
    struct mt_point pos;
    float pressure;
};

struct multitouch
{
    MTDeviceRef dev;
};

void process_cached_finger_data(int identifier);
void multitouch_begin(struct multitouch *multitouch, multitouch_callback *callback);

#endif