summaryrefslogtreecommitdiff
path: root/src/grail-legacy.c
blob: 779595b088c02810e6032853f0d6e853d4c16437 (plain)
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
59
60
61
62
63
64
65
66
/*****************************************************************************
 *
 * grail - Gesture Recognition And Instantiation Library
 *
 * Copyright (C) 2010 Canonical Ltd.
 * Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 ****************************************************************************/

#include <grail.h>
#include "grail-inserter.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <malloc.h>
#include <errno.h>
#include <stdlib.h>

#ifndef GRAIL_NO_LEGACY_ABI

void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage)
{
	struct grail_impl *x = ge->impl;
	x->filter_abs = usage;
}

int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge,
				    struct grail_contact *touch, int max_touch)
{
	const struct gesture_inserter *gin = ge->gin;
	const struct utouch_frame *frame = ge->impl->frame;
	int i;
	if (frame->num_active < max_touch)
		max_touch = frame->num_active;
	for (i = 0; i < max_touch; i++) {
		struct grail_contact *t = &touch[i];
		const struct utouch_contact *ct = frame->active[i];
		t->id = ct->id;
		t->tool_type = ct->tool_type;
		t->pos.x = ct->x;
		t->pos.y = ct->y;
		t->touch_major = ct->touch_major;
		t->touch_minor = ct->touch_minor;
		t->width_major = ct->width_major;
		t->width_minor = ct->width_minor;
		t->angle = ct->orientation;
		t->pressure = ct->pressure;
	}
	return max_touch;
}

#endif