summaryrefslogtreecommitdiff
path: root/usr/src/dkms_source_tree/input-mt.h
blob: fdee06e1cbee07fc442c09969d4b52b013fe0830 (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
#ifndef _INPUT_MT_H
#define _INPUT_MT_H

/*
 * Input Multitouch Library
 *
 * Copyright (c) 2010 Henrik Rydberg
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 */

#include <linux/input.h>

/**
 * struct trk_coord - contact coordinate
 * @x: horizontal coordinate
 * @y: vertical coordinate
 */
struct trk_coord {
	int x;
	int y;
};

int input_mt_create_slots_new(struct input_dev *dev, unsigned int num_slots);

int input_mt_assign_slots_by_coord(struct input_dev *dev, int *slots,
				   const struct trk_coord *coords,
				   int num_coords);

void input_mt_sync_slot_complement(struct input_dev *dev,
				   const int *slots,  int num_slots);

void input_mt_report_state(struct input_dev *dev, bool active);
void input_mt_report_emulation(struct input_dev *dev);

static inline int input_mt_get_value(const struct input_mt_slot *slot,
				     unsigned code)
{
	return slot->abs[code - ABS_MT_FIRST];
}

static inline bool input_mt_get_state(struct input_dev *dev, int slot)
{
	return dev->mt &&
		input_mt_get_value(&dev->mt[slot], ABS_MT_TRACKING_ID) >= 0;
}

static inline void input_abs_set_res(struct input_dev *dev,
				     unsigned int axis, int val)
{
	dev->absres[axis] = val;
}

#endif