diff options
| author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-05-10 14:52:07 -0400 |
|---|---|---|
| committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-05-10 16:50:41 -0400 |
| commit | 020abf03cd659388f94cb328e1e1df0656e0d7ff (patch) | |
| tree | 40d05011708ad1b4a05928d167eb120420581aa6 /include/linux/input/mt.h | |
| parent | 0ff8fbc61727c926883eec381fbd3d32d1fab504 (diff) | |
| parent | 693d92a1bbc9e42681c42ed190bd42b636ca876f (diff) | |
Merge tag 'v2.6.39-rc7'
in order to pull in changes in drivers/media/dvb/firewire/ and
sound/firewire/.
Diffstat (limited to 'include/linux/input/mt.h')
| -rw-r--r-- | include/linux/input/mt.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h new file mode 100644 index 000000000000..318bb82325a6 --- /dev/null +++ b/include/linux/input/mt.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | #ifndef _INPUT_MT_H | ||
| 2 | #define _INPUT_MT_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Input Multitouch Library | ||
| 6 | * | ||
| 7 | * Copyright (c) 2010 Henrik Rydberg | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify it | ||
| 10 | * under the terms of the GNU General Public License version 2 as published by | ||
| 11 | * the Free Software Foundation. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/input.h> | ||
| 15 | |||
| 16 | #define TRKID_MAX 0xffff | ||
| 17 | |||
| 18 | /** | ||
| 19 | * struct input_mt_slot - represents the state of an input MT slot | ||
| 20 | * @abs: holds current values of ABS_MT axes for this slot | ||
| 21 | */ | ||
| 22 | struct input_mt_slot { | ||
| 23 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; | ||
| 24 | }; | ||
| 25 | |||
| 26 | static inline void input_mt_set_value(struct input_mt_slot *slot, | ||
| 27 | unsigned code, int value) | ||
| 28 | { | ||
| 29 | slot->abs[code - ABS_MT_FIRST] = value; | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline int input_mt_get_value(const struct input_mt_slot *slot, | ||
| 33 | unsigned code) | ||
| 34 | { | ||
| 35 | return slot->abs[code - ABS_MT_FIRST]; | ||
| 36 | } | ||
| 37 | |||
| 38 | int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots); | ||
| 39 | void input_mt_destroy_slots(struct input_dev *dev); | ||
| 40 | |||
| 41 | static inline int input_mt_new_trkid(struct input_dev *dev) | ||
| 42 | { | ||
| 43 | return dev->trkid++ & TRKID_MAX; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline void input_mt_slot(struct input_dev *dev, int slot) | ||
| 47 | { | ||
| 48 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline bool input_is_mt_axis(int axis) | ||
| 52 | { | ||
| 53 | return axis == ABS_MT_SLOT || | ||
| 54 | (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST); | ||
| 55 | } | ||
| 56 | |||
| 57 | void input_mt_report_slot_state(struct input_dev *dev, | ||
| 58 | unsigned int tool_type, bool active); | ||
| 59 | |||
| 60 | void input_mt_report_finger_count(struct input_dev *dev, int count); | ||
| 61 | void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); | ||
| 62 | |||
| 63 | #endif | ||
