diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/capabilities.c | 181 | ||||
| -rw-r--r-- | src/capabilities.h | 57 | ||||
| -rw-r--r-- | src/common.h | 95 | ||||
| -rw-r--r-- | src/gestures.h | 43 | ||||
| -rw-r--r-- | src/hwdata.c | 133 | ||||
| -rw-r--r-- | src/hwdata.h | 95 | ||||
| -rw-r--r-- | src/hwstate.c | 2 | ||||
| -rw-r--r-- | src/hwstate.h | 47 | ||||
| -rw-r--r-- | src/iobuffer.c | 54 | ||||
| -rw-r--r-- | src/iobuffer.h | 38 | ||||
| -rw-r--r-- | src/memory.h | 73 | ||||
| -rw-r--r-- | src/mtouch.h | 59 | ||||
| -rw-r--r-- | src/mtstate.h | 62 | ||||
| -rw-r--r-- | src/multitouch.c | 369 | ||||
| -rw-r--r-- | src/test.c | 3 |
15 files changed, 2 insertions, 1309 deletions
diff --git a/src/capabilities.c b/src/capabilities.c deleted file mode 100644 index cd96e8e..0000000 --- a/src/capabilities.c +++ /dev/null | |||
| @@ -1,181 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #include "capabilities.h" | ||
| 23 | |||
| 24 | #define SETABS(c, x, map, key, fd) \ | ||
| 25 | (c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd)) | ||
| 26 | |||
| 27 | #define ADDCAP(s, c, x) strcat(s, c->has_##x ? " " #x : "") | ||
| 28 | |||
| 29 | #define CLICK_AREA(c) ((c->has_ibt ? 0.20 : 0.00) * get_cap_ysize(c)) | ||
| 30 | |||
| 31 | static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */ | ||
| 32 | static const int SN_WIDTH = 100; /* width signal-to-noise ratio */ | ||
| 33 | |||
| 34 | static const int bits_per_long = 8 * sizeof(long); | ||
| 35 | |||
| 36 | static inline int nlongs(int nbit) | ||
| 37 | { | ||
| 38 | return (nbit + bits_per_long - 1) / bits_per_long; | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline int getbit(const unsigned long *map, int key) | ||
| 42 | { | ||
| 43 | return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01; | ||
| 44 | } | ||
| 45 | |||
| 46 | static int getabs(struct input_absinfo *abs, int key, int fd) | ||
| 47 | { | ||
| 48 | int rc; | ||
| 49 | SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs)); | ||
| 50 | return rc >= 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | static int has_integrated_button(const struct Capabilities *cap) | ||
| 54 | { | ||
| 55 | static const int bcm5974_vmask_ibt = 1; | ||
| 56 | if (strcmp(cap->devname, "bcm5974")) | ||
| 57 | return 0; | ||
| 58 | return cap->devid.version & bcm5974_vmask_ibt; | ||
| 59 | } | ||
| 60 | |||
| 61 | int read_capabilities(struct Capabilities *cap, int fd) | ||
| 62 | { | ||
| 63 | unsigned long evbits[nlongs(EV_MAX)]; | ||
| 64 | unsigned long absbits[nlongs(ABS_MAX)]; | ||
| 65 | unsigned long keybits[nlongs(KEY_MAX)]; | ||
| 66 | int rc; | ||
| 67 | |||
| 68 | memset(cap, 0, sizeof(struct Capabilities)); | ||
| 69 | |||
| 70 | SYSCALL(rc = ioctl(fd, EVIOCGID, &cap->devid)); | ||
| 71 | if (rc < 0) | ||
| 72 | return rc; | ||
| 73 | SYSCALL(rc = ioctl(fd, EVIOCGNAME(sizeof(cap->devname)), cap->devname)); | ||
| 74 | if (rc < 0) | ||
| 75 | return rc; | ||
| 76 | SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_SYN, sizeof(evbits)), evbits)); | ||
| 77 | if (rc < 0) | ||
| 78 | return rc; | ||
| 79 | SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits)); | ||
| 80 | if (rc < 0) | ||
| 81 | return rc; | ||
| 82 | SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); | ||
| 83 | if (rc < 0) | ||
| 84 | return rc; | ||
| 85 | |||
| 86 | cap->has_left = getbit(keybits, BTN_LEFT); | ||
| 87 | cap->has_middle = getbit(keybits, BTN_MIDDLE); | ||
| 88 | cap->has_right = getbit(keybits, BTN_RIGHT); | ||
| 89 | |||
| 90 | SETABS(cap, touch_major, absbits, ABS_MT_TOUCH_MAJOR, fd); | ||
| 91 | SETABS(cap, touch_minor, absbits, ABS_MT_TOUCH_MINOR, fd); | ||
| 92 | SETABS(cap, width_major, absbits, ABS_MT_WIDTH_MAJOR, fd); | ||
| 93 | SETABS(cap, width_minor, absbits, ABS_MT_WIDTH_MINOR, fd); | ||
| 94 | SETABS(cap, orientation, absbits, ABS_MT_ORIENTATION, fd); | ||
| 95 | SETABS(cap, position_x, absbits, ABS_MT_POSITION_X, fd); | ||
| 96 | SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd); | ||
| 97 | |||
| 98 | cap->has_mtdata = cap->has_position_x && cap->has_position_y; | ||
| 99 | cap->has_ibt = has_integrated_button(cap); | ||
| 100 | |||
| 101 | cap->xfuzz = cap->abs_position_x.fuzz; | ||
| 102 | cap->yfuzz = cap->abs_position_y.fuzz; | ||
| 103 | if (cap->xfuzz <= 0 || cap->yfuzz <= 0) { | ||
| 104 | cap->xfuzz = get_cap_xsize(cap) / SN_COORD; | ||
| 105 | cap->yfuzz = get_cap_ysize(cap) / SN_COORD; | ||
| 106 | } | ||
| 107 | cap->wfuzz = cap->abs_touch_major.fuzz; | ||
| 108 | if (cap->wfuzz <= 0) | ||
| 109 | cap->wfuzz = get_cap_wsize(cap) / SN_WIDTH; | ||
| 110 | |||
| 111 | cap->yclick = cap->abs_position_y.maximum - CLICK_AREA(cap); | ||
| 112 | |||
| 113 | return 0; | ||
| 114 | } | ||
| 115 | |||
| 116 | int get_cap_xsize(const struct Capabilities *cap) | ||
| 117 | { | ||
| 118 | return cap->abs_position_x.maximum - cap->abs_position_x.minimum; | ||
| 119 | } | ||
| 120 | |||
| 121 | int get_cap_ysize(const struct Capabilities *cap) | ||
| 122 | { | ||
| 123 | return cap->abs_position_y.maximum - cap->abs_position_y.minimum; | ||
| 124 | } | ||
| 125 | |||
| 126 | int get_cap_wsize(const struct Capabilities *cap) | ||
| 127 | { | ||
| 128 | return cap->abs_touch_major.maximum - cap->abs_touch_major.minimum; | ||
| 129 | } | ||
| 130 | |||
| 131 | int get_cap_xmid(const struct Capabilities *cap) | ||
| 132 | { | ||
| 133 | return (cap->abs_position_x.maximum + cap->abs_position_x.minimum) >> 1; | ||
| 134 | } | ||
| 135 | |||
| 136 | int get_cap_ymid(const struct Capabilities *cap) | ||
| 137 | { | ||
| 138 | return (cap->abs_position_y.maximum + cap->abs_position_y.minimum) >> 1; | ||
| 139 | } | ||
| 140 | |||
| 141 | void output_capabilities(const struct Capabilities *cap) | ||
| 142 | { | ||
| 143 | char line[1024]; | ||
| 144 | memset(line, 0, sizeof(line)); | ||
| 145 | ADDCAP(line, cap, left); | ||
| 146 | ADDCAP(line, cap, middle); | ||
| 147 | ADDCAP(line, cap, right); | ||
| 148 | ADDCAP(line, cap, mtdata); | ||
| 149 | ADDCAP(line, cap, ibt); | ||
| 150 | ADDCAP(line, cap, touch_major); | ||
| 151 | ADDCAP(line, cap, touch_minor); | ||
| 152 | ADDCAP(line, cap, width_major); | ||
| 153 | ADDCAP(line, cap, width_minor); | ||
| 154 | ADDCAP(line, cap, orientation); | ||
| 155 | ADDCAP(line, cap, position_x); | ||
| 156 | ADDCAP(line, cap, position_y); | ||
| 157 | xf86Msg(X_INFO, "multitouch: devname: %s\n", cap->devname); | ||
| 158 | xf86Msg(X_INFO, "multitouch: devid: %x %x %x\n", | ||
| 159 | cap->devid.vendor, cap->devid.product, cap->devid.version); | ||
| 160 | xf86Msg(X_INFO, "multitouch: caps:%s\n", line); | ||
| 161 | if (cap->has_touch_major) | ||
| 162 | xf86Msg(X_INFO, "multitouch: touch: %d %d\n", | ||
| 163 | cap->abs_touch_major.minimum, | ||
| 164 | cap->abs_touch_major.maximum); | ||
| 165 | if (cap->has_width_major) | ||
| 166 | xf86Msg(X_INFO, "multitouch: width: %d %d\n", | ||
| 167 | cap->abs_width_major.minimum, | ||
| 168 | cap->abs_width_major.maximum); | ||
| 169 | if (cap->has_orientation) | ||
| 170 | xf86Msg(X_INFO, "multitouch: orientation: %d %d\n", | ||
| 171 | cap->abs_orientation.minimum, | ||
| 172 | cap->abs_orientation.maximum); | ||
| 173 | if (cap->has_position_x) | ||
| 174 | xf86Msg(X_INFO, "multitouch: position_x: %d %d\n", | ||
| 175 | cap->abs_position_x.minimum, | ||
| 176 | cap->abs_position_x.maximum); | ||
| 177 | if (cap->has_position_y) | ||
| 178 | xf86Msg(X_INFO, "multitouch: position_y: %d %d\n", | ||
| 179 | cap->abs_position_y.minimum, | ||
| 180 | cap->abs_position_y.maximum); | ||
| 181 | } | ||
diff --git a/src/capabilities.h b/src/capabilities.h deleted file mode 100644 index 23086bd..0000000 --- a/src/capabilities.h +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef CAPABILITIES_H | ||
| 23 | #define CAPABILITIES_H | ||
| 24 | |||
| 25 | #include "common.h" | ||
| 26 | |||
| 27 | struct Capabilities { | ||
| 28 | struct input_id devid; | ||
| 29 | char devname[32]; | ||
| 30 | int has_left, has_middle; | ||
| 31 | int has_right, has_mtdata, has_ibt; | ||
| 32 | int has_touch_major, has_touch_minor; | ||
| 33 | int has_width_major, has_width_minor; | ||
| 34 | int has_orientation, has_dummy; | ||
| 35 | int has_position_x, has_position_y; | ||
| 36 | struct input_absinfo abs_touch_major; | ||
| 37 | struct input_absinfo abs_touch_minor; | ||
| 38 | struct input_absinfo abs_width_major; | ||
| 39 | struct input_absinfo abs_width_minor; | ||
| 40 | struct input_absinfo abs_orientation; | ||
| 41 | struct input_absinfo abs_position_x; | ||
| 42 | struct input_absinfo abs_position_y; | ||
| 43 | int xfuzz, yfuzz, wfuzz; | ||
| 44 | int yclick; | ||
| 45 | }; | ||
| 46 | |||
| 47 | int read_capabilities(struct Capabilities *cap, int fd); | ||
| 48 | int get_cap_xsize(const struct Capabilities *cap); | ||
| 49 | int get_cap_ysize(const struct Capabilities *cap); | ||
| 50 | int get_cap_wsize(const struct Capabilities *cap); | ||
| 51 | |||
| 52 | int get_cap_xmid(const struct Capabilities *cap); | ||
| 53 | int get_cap_ymid(const struct Capabilities *cap); | ||
| 54 | |||
| 55 | void output_capabilities(const struct Capabilities *cap); | ||
| 56 | |||
| 57 | #endif | ||
diff --git a/src/common.h b/src/common.h deleted file mode 100644 index 32be48d..0000000 --- a/src/common.h +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef COMMON_H | ||
| 23 | #define COMMON_H | ||
| 24 | |||
| 25 | #include "xorg-server.h" | ||
| 26 | #include <xf86.h> | ||
| 27 | #include <xf86_OSproc.h> | ||
| 28 | #include <xf86Xinput.h> | ||
| 29 | #include <linux/input.h> | ||
| 30 | #include <errno.h> | ||
| 31 | #include <match/match.h> | ||
| 32 | |||
| 33 | /* includes available in 2.6.30-rc5 */ | ||
| 34 | |||
| 35 | #ifndef BTN_TOOL_QUADTAP | ||
| 36 | #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ | ||
| 37 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | ||
| 38 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | ||
| 39 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | ||
| 40 | #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ | ||
| 41 | #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ | ||
| 42 | #define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ | ||
| 43 | #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ | ||
| 44 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | ||
| 45 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | ||
| 46 | #define SYN_MT_REPORT 2 | ||
| 47 | #define MT_TOOL_FINGER 0 | ||
| 48 | #define MT_TOOL_PEN 1 | ||
| 49 | #endif | ||
| 50 | |||
| 51 | /* includes available in 2.6.33 */ | ||
| 52 | #ifndef ABS_MT_PRESSURE | ||
| 53 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) | ||
| 57 | |||
| 58 | #define BITMASK(x) (1U << (x)) | ||
| 59 | #define BITONES(x) (BITMASK(x) - 1U) | ||
| 60 | #define GETBIT(m, x) (((m) >> (x)) & 1U) | ||
| 61 | #define SETBIT(m, x) (m |= BITMASK(x)) | ||
| 62 | #define CLEARBIT(m, x) (m &= ~BITMASK(x)) | ||
| 63 | |||
| 64 | static inline int maxval(int x, int y) { return x > y ? x : y; } | ||
| 65 | static inline int minval(int x, int y) { return x < y ? x : y; } | ||
| 66 | |||
| 67 | static inline int clamp15(int x) | ||
| 68 | { | ||
| 69 | return x < -32767 ? -32767 : x > 32767 ? 32767 : x; | ||
| 70 | } | ||
| 71 | |||
| 72 | /* absolute scale is assumed to fit in 15 bits */ | ||
| 73 | static inline int dist2(int dx, int dy) | ||
| 74 | { | ||
| 75 | dx = clamp15(dx); | ||
| 76 | dy = clamp15(dy); | ||
| 77 | return dx * dx + dy * dy; | ||
| 78 | } | ||
| 79 | |||
| 80 | /* Count number of bits (Sean Eron Andersson's Bit Hacks) */ | ||
| 81 | static inline int bitcount(unsigned v) | ||
| 82 | { | ||
| 83 | v -= ((v>>1) & 0x55555555); | ||
| 84 | v = (v&0x33333333) + ((v>>2) & 0x33333333); | ||
| 85 | return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24; | ||
| 86 | } | ||
| 87 | |||
| 88 | /* Return index of first bit [0-31], -1 on zero */ | ||
| 89 | #define firstbit(v) (__builtin_ffs(v) - 1) | ||
| 90 | |||
| 91 | /* boost-style foreach bit */ | ||
| 92 | #define foreach_bit(i, m) \ | ||
| 93 | for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << i + 1))) | ||
| 94 | |||
| 95 | #endif | ||
diff --git a/src/gestures.h b/src/gestures.h deleted file mode 100644 index 2866ba4..0000000 --- a/src/gestures.h +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef GESTURES_H | ||
| 23 | #define GESTURES_H | ||
| 24 | |||
| 25 | #include "mtouch.h" | ||
| 26 | |||
| 27 | #define GS_BUTTON 0 | ||
| 28 | #define GS_MOVE 1 | ||
| 29 | #define GS_VSCROLL 2 | ||
| 30 | #define GS_HSCROLL 3 | ||
| 31 | #define GS_VSWIPE 4 | ||
| 32 | #define GS_HSWIPE 5 | ||
| 33 | #define GS_SCALE 6 | ||
| 34 | #define GS_ROTATE 7 | ||
| 35 | |||
| 36 | struct Gestures { | ||
| 37 | unsigned type, btmask, btdata; | ||
| 38 | int same_fingers, dx, dy, scale, rot; | ||
| 39 | }; | ||
| 40 | |||
| 41 | void extract_gestures(struct Gestures *gs, struct MTouch* mt); | ||
| 42 | |||
| 43 | #endif | ||
diff --git a/src/hwdata.c b/src/hwdata.c deleted file mode 100644 index 689418e..0000000 --- a/src/hwdata.c +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #include "hwdata.h" | ||
| 23 | |||
| 24 | void init_hwdata(struct HWData *hw) | ||
| 25 | { | ||
| 26 | memset(hw, 0, sizeof(struct HWData)); | ||
| 27 | } | ||
| 28 | |||
| 29 | static void set_value(struct HWData *hw, int code, int value) | ||
| 30 | { | ||
| 31 | if (hw->nread < DIM_FINGER) { | ||
| 32 | (&hw->finger[hw->nread].touch_major)[code] = value; | ||
| 33 | SETBIT(hw->mread[hw->nread], code); | ||
| 34 | } | ||
| 35 | hw->mtread++; | ||
| 36 | } | ||
| 37 | |||
| 38 | static void accept_finger(struct HWData *hw) | ||
| 39 | { | ||
| 40 | if (hw->nread < DIM_FINGER && | ||
| 41 | GETBIT(hw->mread[hw->nread], BIT_MT_POSITION_X) && | ||
| 42 | GETBIT(hw->mread[hw->nread], BIT_MT_POSITION_Y)) { | ||
| 43 | hw->mask[hw->nread] = hw->mread[hw->nread]; | ||
| 44 | hw->nread++; | ||
| 45 | } | ||
| 46 | if (hw->nread < DIM_FINGER) | ||
| 47 | hw->mread[hw->nread] = 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | static void accept_packet(struct HWData *hw, const struct timeval* tv) | ||
| 51 | { | ||
| 52 | static const mstime_t ms = 1000; | ||
| 53 | if (hw->mtread) | ||
| 54 | hw->nfinger = hw->nread; | ||
| 55 | hw->mtread = 0; | ||
| 56 | hw->nread = 0; | ||
| 57 | hw->mread[hw->nread] = 0; | ||
| 58 | hw->evtime = tv->tv_usec / ms + tv->tv_sec * ms; | ||
| 59 | } | ||
| 60 | |||
| 61 | int read_hwdata(struct HWData *hw, const struct input_event* ev) | ||
| 62 | { | ||
| 63 | switch (ev->type) { | ||
| 64 | case EV_SYN: | ||
| 65 | switch (ev->code) { | ||
| 66 | case SYN_REPORT: | ||
| 67 | accept_packet(hw, &ev->time); | ||
| 68 | return 1; | ||
| 69 | case SYN_MT_REPORT: | ||
| 70 | accept_finger(hw); | ||
| 71 | break; | ||
| 72 | } | ||
| 73 | break; | ||
| 74 | case EV_KEY: | ||
| 75 | switch (ev->code) { | ||
| 76 | case BTN_TOUCH: | ||
| 77 | hw->mtread++; | ||
| 78 | break; | ||
| 79 | case BTN_LEFT: | ||
| 80 | if (ev->value) | ||
| 81 | SETBIT(hw->button, MT_BUTTON_LEFT); | ||
| 82 | else | ||
| 83 | CLEARBIT(hw->button, MT_BUTTON_LEFT); | ||
| 84 | break; | ||
| 85 | case BTN_MIDDLE: | ||
| 86 | if (ev->value) | ||
| 87 | SETBIT(hw->button, MT_BUTTON_MIDDLE); | ||
| 88 | else | ||
| 89 | CLEARBIT(hw->button, MT_BUTTON_MIDDLE); | ||
| 90 | break; | ||
| 91 | case BTN_RIGHT: | ||
| 92 | if (ev->value) | ||
| 93 | SETBIT(hw->button, MT_BUTTON_RIGHT); | ||
| 94 | else | ||
| 95 | CLEARBIT(hw->button, MT_BUTTON_RIGHT); | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | break; | ||
| 99 | case EV_ABS: | ||
| 100 | switch (ev->code) { | ||
| 101 | case ABS_MT_TOUCH_MAJOR: | ||
| 102 | set_value(hw, BIT_MT_TOUCH_MAJOR, ev->value); | ||
| 103 | break; | ||
| 104 | case ABS_MT_TOUCH_MINOR: | ||
| 105 | set_value(hw, BIT_MT_TOUCH_MINOR, ev->value); | ||
| 106 | break; | ||
| 107 | case ABS_MT_WIDTH_MAJOR: | ||
| 108 | set_value(hw, BIT_MT_WIDTH_MAJOR, ev->value); | ||
| 109 | break; | ||
| 110 | case ABS_MT_WIDTH_MINOR: | ||
| 111 | set_value(hw, BIT_MT_WIDTH_MINOR, ev->value); | ||
| 112 | break; | ||
| 113 | case ABS_MT_ORIENTATION: | ||
| 114 | set_value(hw, BIT_MT_ORIENTATION, ev->value); | ||
| 115 | break; | ||
| 116 | case ABS_MT_PRESSURE: | ||
| 117 | set_value(hw, BIT_MT_PRESSURE, ev->value); | ||
| 118 | break; | ||
| 119 | case ABS_MT_POSITION_X: | ||
| 120 | set_value(hw, BIT_MT_POSITION_X, ev->value); | ||
| 121 | break; | ||
| 122 | case ABS_MT_POSITION_Y: | ||
| 123 | set_value(hw, BIT_MT_POSITION_Y, ev->value); | ||
| 124 | break; | ||
| 125 | } | ||
| 126 | break; | ||
| 127 | } | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | |||
| 131 | void output_hwdata(const struct HWData *hw) | ||
| 132 | { | ||
| 133 | } | ||
diff --git a/src/hwdata.h b/src/hwdata.h deleted file mode 100644 index 42d0a19..0000000 --- a/src/hwdata.h +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef HWDATA_H | ||
| 23 | #define HWDATA_H | ||
| 24 | |||
| 25 | #include "common.h" | ||
| 26 | |||
| 27 | #define DIM_BUTTON 15 | ||
| 28 | |||
| 29 | #define MT_BUTTON_LEFT 0 | ||
| 30 | #define MT_BUTTON_MIDDLE 1 | ||
| 31 | #define MT_BUTTON_RIGHT 2 | ||
| 32 | #define MT_BUTTON_WHEEL_UP 3 | ||
| 33 | #define MT_BUTTON_WHEEL_DOWN 4 | ||
| 34 | #define MT_BUTTON_HWHEEL_LEFT 5 | ||
| 35 | #define MT_BUTTON_HWHEEL_RIGHT 6 | ||
| 36 | #define MT_BUTTON_SWIPE_UP 7 | ||
| 37 | #define MT_BUTTON_SWIPE_DOWN 8 | ||
| 38 | #define MT_BUTTON_SWIPE_LEFT 9 | ||
| 39 | #define MT_BUTTON_SWIPE_RIGHT 10 | ||
| 40 | #define MT_BUTTON_SCALE_DOWN 11 | ||
| 41 | #define MT_BUTTON_SCALE_UP 12 | ||
| 42 | #define MT_BUTTON_ROTATE_LEFT 13 | ||
| 43 | #define MT_BUTTON_ROTATE_RIGHT 14 | ||
| 44 | |||
| 45 | #define BIT_MT_TOUCH_MAJOR 0 | ||
| 46 | #define BIT_MT_TOUCH_MINOR 1 | ||
| 47 | #define BIT_MT_WIDTH_MAJOR 2 | ||
| 48 | #define BIT_MT_WIDTH_MINOR 3 | ||
| 49 | #define BIT_MT_ORIENTATION 4 | ||
| 50 | #define BIT_MT_PRESSURE 5 | ||
| 51 | #define BIT_MT_POSITION_X 6 | ||
| 52 | #define BIT_MT_POSITION_Y 7 | ||
| 53 | #define BIT_MT_CNT 8 | ||
| 54 | |||
| 55 | struct FingerData { | ||
| 56 | int touch_major, touch_minor; | ||
| 57 | int width_major, width_minor; | ||
| 58 | int orientation, pressure; | ||
| 59 | int position_x, position_y; | ||
| 60 | }; | ||
| 61 | |||
| 62 | /* year-proof millisecond event time */ | ||
| 63 | typedef __u64 mstime_t; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * struct HWData - hardware reads | ||
| 67 | * | ||
| 68 | * @finger: finger data | ||
| 69 | * @mask: bits corresponding to data actually read (readonly) | ||
| 70 | * @mread: bits corresponding to data in progress (writeonly) | ||
| 71 | * @button: bitmask of buttons | ||
| 72 | * @nfinger: number of fingers actually read (readonly) | ||
| 73 | * @nread: number of fingers in progress (writeonly) | ||
| 74 | * | ||
| 75 | */ | ||
| 76 | struct HWData { | ||
| 77 | struct FingerData finger[DIM_FINGER]; | ||
| 78 | unsigned mask[DIM_FINGER], mread[DIM_FINGER]; | ||
| 79 | unsigned button; | ||
| 80 | int nfinger, mtread, nread; | ||
| 81 | mstime_t evtime; | ||
| 82 | }; | ||
| 83 | |||
| 84 | void init_hwdata(struct HWData *hw); | ||
| 85 | int read_hwdata(struct HWData *hw, const struct input_event* ev); | ||
| 86 | void output_hwdata(const struct HWData *hw); | ||
| 87 | |||
| 88 | static inline int finger_dist2(const struct FingerData *a, | ||
| 89 | const struct FingerData *b) | ||
| 90 | { | ||
| 91 | return dist2(a->position_x - b->position_x, | ||
| 92 | a->position_y - b->position_y); | ||
| 93 | } | ||
| 94 | |||
| 95 | #endif | ||
diff --git a/src/hwstate.c b/src/hwstate.c index a68b81a..81f4b8b 100644 --- a/src/hwstate.c +++ b/src/hwstate.c | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | **************************************************************************/ | 20 | **************************************************************************/ |
| 21 | 21 | ||
| 22 | #include "hwstate.h" | 22 | #include "hwstate.h" |
| 23 | #include <stdlib.h> | ||
| 24 | #include <limits.h> | ||
| 25 | 23 | ||
| 26 | #define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) | 24 | #define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) |
| 27 | 25 | ||
diff --git a/src/hwstate.h b/src/hwstate.h deleted file mode 100644 index b8c2ba0..0000000 --- a/src/hwstate.h +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef MTEVENT_H | ||
| 23 | #define MTEVENT_H | ||
| 24 | |||
| 25 | #include "capabilities.h" | ||
| 26 | #include "hwdata.h" | ||
| 27 | |||
| 28 | /* zero id means not mapped (not touching) */ | ||
| 29 | struct FingerState { | ||
| 30 | struct FingerData hw; | ||
| 31 | int id; | ||
| 32 | }; | ||
| 33 | |||
| 34 | struct HWState { | ||
| 35 | struct FingerState finger[DIM_FINGER]; | ||
| 36 | unsigned button; | ||
| 37 | int nfinger; | ||
| 38 | mstime_t evtime; | ||
| 39 | int lastid; | ||
| 40 | }; | ||
| 41 | |||
| 42 | void init_hwstate(struct HWState *s); | ||
| 43 | void modify_hwstate(struct HWState *s, | ||
| 44 | const struct HWData *hw, | ||
| 45 | const struct Capabilities *caps); | ||
| 46 | |||
| 47 | #endif | ||
diff --git a/src/iobuffer.c b/src/iobuffer.c deleted file mode 100644 index 35b61e9..0000000 --- a/src/iobuffer.c +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #include "iobuffer.h" | ||
| 23 | |||
| 24 | void init_iobuf(struct IOBuffer *buf) | ||
| 25 | { | ||
| 26 | memset(buf, 0, sizeof(struct IOBuffer)); | ||
| 27 | buf->at = buf->begin; | ||
| 28 | buf->top = buf->at; | ||
| 29 | buf->end = buf->begin + DIM_BUFFER; | ||
| 30 | } | ||
| 31 | |||
| 32 | const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd) | ||
| 33 | { | ||
| 34 | const struct input_event *ev; | ||
| 35 | int n = buf->top - buf->at; | ||
| 36 | if (n < EVENT_SIZE) { | ||
| 37 | /* partial event is available: save it */ | ||
| 38 | if (buf->at != buf->begin && n > 0) | ||
| 39 | memmove(buf->begin, buf->at, n); | ||
| 40 | /* start from the beginning */ | ||
| 41 | buf->at = buf->begin; | ||
| 42 | buf->top = buf->at + n; | ||
| 43 | /* read more data */ | ||
| 44 | SYSCALL(n = read(fd, buf->top, buf->end - buf->top)); | ||
| 45 | if (n <= 0) | ||
| 46 | return NULL; | ||
| 47 | buf->top += n; | ||
| 48 | } | ||
| 49 | if (buf->top - buf->at < EVENT_SIZE) | ||
| 50 | return NULL; | ||
| 51 | ev = (const struct input_event *)buf->at; | ||
| 52 | buf->at += EVENT_SIZE; | ||
| 53 | return ev; | ||
| 54 | } | ||
diff --git a/src/iobuffer.h b/src/iobuffer.h deleted file mode 100644 index 2e3d0c8..0000000 --- a/src/iobuffer.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef IOBUFFER_H | ||
| 23 | #define IOBUFFER_H | ||
| 24 | |||
| 25 | #include "common.h" | ||
| 26 | |||
| 27 | #define EVENT_SIZE sizeof(struct input_event) | ||
| 28 | #define DIM_EVENTS 64 | ||
| 29 | #define DIM_BUFFER (DIM_EVENTS * EVENT_SIZE) | ||
| 30 | |||
| 31 | struct IOBuffer { | ||
| 32 | char begin[DIM_BUFFER], *at, *top, *end; | ||
| 33 | }; | ||
| 34 | |||
| 35 | void init_iobuf(struct IOBuffer *buf); | ||
| 36 | const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd); | ||
| 37 | |||
| 38 | #endif | ||
diff --git a/src/memory.h b/src/memory.h deleted file mode 100644 index 8ffbdab..0000000 --- a/src/memory.h +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef MEMORY_H | ||
| 23 | #define MEMORY_H | ||
| 24 | |||
| 25 | #include "mtstate.h" | ||
| 26 | |||
| 27 | /** | ||
| 28 | * struct Memory - parsing state | ||
| 29 | * | ||
| 30 | * @btdata: logical finger state | ||
| 31 | * @same: true if the finger configuration is unchanged | ||
| 32 | * @fingers: bitmask of fingers on the pad | ||
| 33 | * @added: bitmask of new fingers on the pad | ||
| 34 | * @thumb: bitmask of thumbs on the pad | ||
| 35 | * @pointing: bitmask of pointing fingers | ||
| 36 | * @pending: bitmask of tentatively moving fingers | ||
| 37 | * @moving: bitmask of moving fingers | ||
| 38 | * @ybar: vertical position on pad marking the clicking area | ||
| 39 | * @mvhold: movement before this point in time is accumulated | ||
| 40 | * @mvforget: movement before this point in time is discarded | ||
| 41 | * @dx: array of accumulated horiontal movement per finger | ||
| 42 | * @dy: array of accumulated vertical movement per finger | ||
| 43 | * | ||
| 44 | */ | ||
| 45 | struct Memory { | ||
| 46 | unsigned btdata, same; | ||
| 47 | unsigned fingers, added, thumb; | ||
| 48 | unsigned pointing, pending, moving; | ||
| 49 | int ybar; | ||
| 50 | mstime_t mvhold, mvforget; | ||
| 51 | int dx[DIM_FINGER], dy[DIM_FINGER]; | ||
| 52 | }; | ||
| 53 | |||
| 54 | void init_memory(struct Memory *mem); | ||
| 55 | void refresh_memory(struct Memory *m, | ||
| 56 | const struct MTState *prev_state, | ||
| 57 | const struct MTState *state, | ||
| 58 | const struct Capabilities *caps); | ||
| 59 | void output_memory(const struct Memory *m); | ||
| 60 | |||
| 61 | static inline void mem_hold_movement(struct Memory *m, mstime_t t) | ||
| 62 | { | ||
| 63 | if (t > m->mvhold) | ||
| 64 | m->mvhold = t; | ||
| 65 | } | ||
| 66 | |||
| 67 | static inline void mem_forget_movement(struct Memory *m, mstime_t t) | ||
| 68 | { | ||
| 69 | if (t > m->mvforget) | ||
| 70 | m->mvforget = t; | ||
| 71 | } | ||
| 72 | |||
| 73 | #endif | ||
diff --git a/src/mtouch.h b/src/mtouch.h deleted file mode 100644 index aab35bd..0000000 --- a/src/mtouch.h +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef MTOUCH_H | ||
| 23 | #define MTOUCH_H | ||
| 24 | |||
| 25 | #include "capabilities.h" | ||
| 26 | #include "iobuffer.h" | ||
| 27 | #include "hwdata.h" | ||
| 28 | #include "hwstate.h" | ||
| 29 | #include "mtstate.h" | ||
| 30 | #include "memory.h" | ||
| 31 | |||
| 32 | struct MTouch { | ||
| 33 | struct Capabilities caps; | ||
| 34 | struct IOBuffer buf; | ||
| 35 | struct HWData hw; | ||
| 36 | struct HWState hs; | ||
| 37 | struct MTState prev_state, state; | ||
| 38 | struct Memory mem; | ||
| 39 | }; | ||
| 40 | |||
| 41 | int configure_mtouch(struct MTouch *mt, int fd); | ||
| 42 | int open_mtouch(struct MTouch *mt, int fd); | ||
| 43 | int close_mtouch(struct MTouch *mt, int fd); | ||
| 44 | |||
| 45 | int read_synchronized_event(struct MTouch *mt, int fd); | ||
| 46 | void parse_event(struct MTouch *mt); | ||
| 47 | |||
| 48 | |||
| 49 | static inline void mt_delay_movement(struct MTouch *mt, int t) | ||
| 50 | { | ||
| 51 | mem_hold_movement(&mt->mem, mt->state.evtime + t); | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void mt_skip_movement(struct MTouch *mt, int t) | ||
| 55 | { | ||
| 56 | mem_forget_movement(&mt->mem, mt->state.evtime + t); | ||
| 57 | } | ||
| 58 | |||
| 59 | #endif | ||
diff --git a/src/mtstate.h b/src/mtstate.h deleted file mode 100644 index ac0b18d..0000000 --- a/src/mtstate.h +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef MTSTATE_H | ||
| 23 | #define MTSTATE_H | ||
| 24 | |||
| 25 | #include "hwstate.h" | ||
| 26 | |||
| 27 | struct MTFinger { | ||
| 28 | struct FingerData hw; | ||
| 29 | int id, thumb; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct MTState { | ||
| 33 | struct MTFinger finger[DIM_FINGER]; | ||
| 34 | int nfinger; | ||
| 35 | unsigned button; | ||
| 36 | mstime_t evtime; | ||
| 37 | }; | ||
| 38 | |||
| 39 | void init_mtstate(struct MTState *s); | ||
| 40 | void extract_mtstate(struct MTState *s, | ||
| 41 | const struct HWState *hs, | ||
| 42 | const struct Capabilities *caps); | ||
| 43 | void output_mtstate(const struct MTState *s); | ||
| 44 | |||
| 45 | const struct MTFinger *find_finger(const struct MTState *s, int id); | ||
| 46 | |||
| 47 | |||
| 48 | static inline int center_dist2(const struct MTFinger *a, | ||
| 49 | const struct Capabilities *caps) | ||
| 50 | { | ||
| 51 | return dist2(a->hw.position_x - get_cap_xmid(caps), | ||
| 52 | a->hw.position_y - get_cap_ymid(caps)); | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int center_maxdist2(const struct Capabilities *caps) | ||
| 56 | { | ||
| 57 | return dist2(caps->abs_position_x.maximum - get_cap_xmid(caps), | ||
| 58 | caps->abs_position_y.maximum - get_cap_ymid(caps)); | ||
| 59 | } | ||
| 60 | |||
| 61 | #endif | ||
| 62 | |||
diff --git a/src/multitouch.c b/src/multitouch.c deleted file mode 100644 index 7e275b3..0000000 --- a/src/multitouch.c +++ /dev/null | |||
| @@ -1,369 +0,0 @@ | |||
| 1 | /*************************************************************************** | ||
| 2 | * | ||
| 3 | * Multitouch X driver | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | * | ||
| 20 | **************************************************************************/ | ||
| 21 | |||
| 22 | #include "gestures.h" | ||
| 23 | |||
| 24 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 25 | #include <X11/Xatom.h> | ||
| 26 | #include <xserver-properties.h> | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* these should be user-configurable at some point */ | ||
| 30 | static const float vscroll_fraction = 0.05; | ||
| 31 | static const float hscroll_fraction = 0.05; | ||
| 32 | static const float vswipe_fraction = 0.25; | ||
| 33 | static const float hswipe_fraction = 0.25; | ||
| 34 | static const float scale_fraction = 0.05; | ||
| 35 | static const float rot_fraction = 0.05; | ||
| 36 | |||
| 37 | /* flip these to enable event debugging */ | ||
| 38 | #if 1 | ||
| 39 | #define TRACE1(format, arg1) | ||
| 40 | #define TRACE2(format, arg1, arg2) | ||
| 41 | #else | ||
| 42 | #define TRACE1(format, arg1) xf86Msg(X_INFO, format, arg1) | ||
| 43 | #define TRACE2(format, arg1, arg2) xf86Msg(X_INFO, format, arg1, arg2) | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* button mapping simplified */ | ||
| 47 | #define PROPMAP(m, x, y) m[x] = XIGetKnownProperty(y) | ||
| 48 | |||
| 49 | static void pointer_control(DeviceIntPtr dev, PtrCtrl *ctrl) | ||
| 50 | { | ||
| 51 | xf86Msg(X_INFO, "pointer_control\n"); | ||
| 52 | } | ||
| 53 | |||
| 54 | static int pointer_property(DeviceIntPtr dev, | ||
| 55 | Atom property, | ||
| 56 | XIPropertyValuePtr prop, | ||
| 57 | BOOL checkonly) | ||
| 58 | { | ||
| 59 | xf86Msg(X_INFO, "pointer_property\n"); | ||
| 60 | return Success; | ||
| 61 | } | ||
| 62 | |||
| 63 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 64 | static void initAxesLabels(Atom map[2]) | ||
| 65 | { | ||
| 66 | memset(map, 0, 2 * sizeof(Atom)); | ||
| 67 | PROPMAP(map, 0, AXIS_LABEL_PROP_REL_X); | ||
| 68 | PROPMAP(map, 1, AXIS_LABEL_PROP_REL_Y); | ||
| 69 | } | ||
| 70 | |||
| 71 | static void initButtonLabels(Atom map[DIM_BUTTON]) | ||
| 72 | { | ||
| 73 | memset(map, 0, DIM_BUTTON * sizeof(Atom)); | ||
| 74 | PROPMAP(map, MT_BUTTON_LEFT, BTN_LABEL_PROP_BTN_LEFT); | ||
| 75 | PROPMAP(map, MT_BUTTON_MIDDLE, BTN_LABEL_PROP_BTN_MIDDLE); | ||
| 76 | PROPMAP(map, MT_BUTTON_RIGHT, BTN_LABEL_PROP_BTN_RIGHT); | ||
| 77 | PROPMAP(map, MT_BUTTON_WHEEL_UP, BTN_LABEL_PROP_BTN_WHEEL_UP); | ||
| 78 | PROPMAP(map, MT_BUTTON_WHEEL_DOWN, BTN_LABEL_PROP_BTN_WHEEL_DOWN); | ||
| 79 | PROPMAP(map, MT_BUTTON_HWHEEL_LEFT, BTN_LABEL_PROP_BTN_HWHEEL_LEFT); | ||
| 80 | PROPMAP(map, MT_BUTTON_HWHEEL_RIGHT, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); | ||
| 81 | /* how to map swipe buttons? */ | ||
| 82 | PROPMAP(map, MT_BUTTON_SWIPE_UP, BTN_LABEL_PROP_BTN_0); | ||
| 83 | PROPMAP(map, MT_BUTTON_SWIPE_DOWN, BTN_LABEL_PROP_BTN_1); | ||
| 84 | PROPMAP(map, MT_BUTTON_SWIPE_LEFT, BTN_LABEL_PROP_BTN_2); | ||
| 85 | PROPMAP(map, MT_BUTTON_SWIPE_RIGHT, BTN_LABEL_PROP_BTN_3); | ||
| 86 | /* how to map scale and rotate? */ | ||
| 87 | PROPMAP(map, MT_BUTTON_SCALE_DOWN, BTN_LABEL_PROP_BTN_4); | ||
| 88 | PROPMAP(map, MT_BUTTON_SCALE_UP, BTN_LABEL_PROP_BTN_5); | ||
| 89 | PROPMAP(map, MT_BUTTON_ROTATE_LEFT, BTN_LABEL_PROP_BTN_6); | ||
| 90 | PROPMAP(map, MT_BUTTON_ROTATE_RIGHT, BTN_LABEL_PROP_BTN_7); | ||
| 91 | } | ||
| 92 | #endif | ||
| 93 | |||
| 94 | static int device_init(DeviceIntPtr dev, LocalDevicePtr local) | ||
| 95 | { | ||
| 96 | struct MTouch *mt = local->private; | ||
| 97 | unsigned char btmap[DIM_BUTTON + 1] = { | ||
| 98 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 | ||
| 99 | }; | ||
| 100 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 101 | Atom axes_labels[2], btn_labels[DIM_BUTTON]; | ||
| 102 | initAxesLabels(axes_labels); | ||
| 103 | initButtonLabels(btn_labels); | ||
| 104 | #endif | ||
| 105 | |||
| 106 | local->fd = xf86OpenSerial(local->options); | ||
| 107 | if (local->fd < 0) { | ||
| 108 | xf86Msg(X_ERROR, "multitouch: cannot open device\n"); | ||
| 109 | return !Success; | ||
| 110 | } | ||
| 111 | if (configure_mtouch(mt, local->fd)) { | ||
| 112 | xf86Msg(X_ERROR, "multitouch: cannot configure device\n"); | ||
| 113 | return !Success; | ||
| 114 | } | ||
| 115 | xf86CloseSerial(local->fd); | ||
| 116 | |||
| 117 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 | ||
| 118 | InitPointerDeviceStruct((DevicePtr)dev, | ||
| 119 | btmap, DIM_BUTTON, | ||
| 120 | GetMotionHistory, | ||
| 121 | pointer_control, | ||
| 122 | GetMotionHistorySize(), | ||
| 123 | 2); | ||
| 124 | #elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 7 | ||
| 125 | InitPointerDeviceStruct((DevicePtr)dev, | ||
| 126 | btmap, DIM_BUTTON, | ||
| 127 | pointer_control, | ||
| 128 | GetMotionHistorySize(), | ||
| 129 | 2); | ||
| 130 | #elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 131 | InitPointerDeviceStruct((DevicePtr)dev, | ||
| 132 | btmap, DIM_BUTTON, btn_labels, | ||
| 133 | pointer_control, | ||
| 134 | GetMotionHistorySize(), | ||
| 135 | 2, axes_labels); | ||
| 136 | #else | ||
| 137 | #error "Unsupported ABI_XINPUT_VERSION" | ||
| 138 | #endif | ||
| 139 | |||
| 140 | xf86InitValuatorAxisStruct(dev, 0, | ||
| 141 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 142 | axes_labels[0], | ||
| 143 | #endif | ||
| 144 | mt->caps.abs_position_x.minimum, | ||
| 145 | mt->caps.abs_position_x.maximum, | ||
| 146 | 1, 0, 1); | ||
| 147 | xf86InitValuatorDefaults(dev, 0); | ||
| 148 | xf86InitValuatorAxisStruct(dev, 1, | ||
| 149 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 | ||
| 150 | axes_labels[1], | ||
| 151 | #endif | ||
| 152 | mt->caps.abs_position_y.minimum, | ||
| 153 | mt->caps.abs_position_y.maximum, | ||
| 154 | 1, 0, 1); | ||
| 155 | xf86InitValuatorDefaults(dev, 1); | ||
| 156 | |||
| 157 | XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL); | ||
| 158 | |||
| 159 | return Success; | ||
| 160 | } | ||
| 161 | |||
| 162 | static int device_on(LocalDevicePtr local) | ||
| 163 | { | ||
| 164 | struct MTouch *mt = local->private; | ||
| 165 | local->fd = xf86OpenSerial(local->options); | ||
| 166 | if (local->fd < 0) { | ||
| 167 | xf86Msg(X_ERROR, "multitouch: cannot open device\n"); | ||
| 168 | return !Success; | ||
| 169 | } | ||
| 170 | if (open_mtouch(mt, local->fd)) { | ||
| 171 | xf86Msg(X_ERROR, "multitouch: cannot grab device\n"); | ||
| 172 | return !Success; | ||
| 173 | } | ||
| 174 | xf86AddEnabledDevice(local); | ||
| 175 | return Success; | ||
| 176 | } | ||
| 177 | |||
| 178 | static int device_off(LocalDevicePtr local) | ||
| 179 | { | ||
| 180 | struct MTouch *mt = local->private; | ||
| 181 | xf86RemoveEnabledDevice(local); | ||
| 182 | if (close_mtouch(mt, local->fd)) | ||
| 183 | xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n"); | ||
| 184 | xf86CloseSerial(local->fd); | ||
| 185 | return Success; | ||
| 186 | } | ||
| 187 | |||
| 188 | static int device_close(LocalDevicePtr local) | ||
| 189 | { | ||
| 190 | return Success; | ||
| 191 | } | ||
| 192 | |||
| 193 | static void tickle_button(LocalDevicePtr local, int id) | ||
| 194 | { | ||
| 195 | xf86PostButtonEvent(local->dev, FALSE, id, 1, 0, 0); | ||
| 196 | xf86PostButtonEvent(local->dev, FALSE, id, 0, 0, 0); | ||
| 197 | } | ||
| 198 | |||
| 199 | static void button_scroll(LocalDevicePtr local, | ||
| 200 | int btdec, int btinc, | ||
| 201 | int *scroll, int step, | ||
| 202 | int delta) | ||
| 203 | { | ||
| 204 | *scroll += delta; | ||
| 205 | while (*scroll > step) { | ||
| 206 | tickle_button(local, btinc); | ||
| 207 | *scroll -= step; | ||
| 208 | } | ||
| 209 | while (*scroll < -step) { | ||
| 210 | tickle_button(local, btdec); | ||
| 211 | *scroll += step; | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 215 | static void handle_gestures(LocalDevicePtr local, | ||
| 216 | const struct Gestures *gs, | ||
| 217 | const struct Capabilities *caps) | ||
| 218 | { | ||
| 219 | static int vscroll, hscroll, vswipe, hswipe, scale, rot; | ||
| 220 | int vscrollstep = 1 + vscroll_fraction * get_cap_ysize(caps); | ||
| 221 | int hscrollstep = 1 + hscroll_fraction * get_cap_xsize(caps); | ||
| 222 | int vswipestep = 1 + vswipe_fraction * get_cap_ysize(caps); | ||
| 223 | int hswipestep = 1 + hswipe_fraction * get_cap_xsize(caps); | ||
| 224 | int scalestep = 1 + scale_fraction * get_cap_xsize(caps); | ||
| 225 | int rotstep = 1 + rot_fraction * get_cap_xsize(caps); | ||
| 226 | int i; | ||
| 227 | if (!gs->same_fingers) { | ||
| 228 | vscroll = 0; | ||
| 229 | hscroll = 0; | ||
| 230 | vswipe = 0; | ||
| 231 | hswipe = 0; | ||
| 232 | } | ||
| 233 | for (i = 0; i < DIM_BUTTON; i++) { | ||
| 234 | if (GETBIT(gs->btmask, i)) { | ||
| 235 | xf86PostButtonEvent(local->dev, FALSE, | ||
| 236 | i + 1, GETBIT(gs->btdata, i), 0, 0); | ||
| 237 | TRACE2("button bit: %d %d\n", i, GETBIT(gs->btdata, i)); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | if (GETBIT(gs->type, GS_MOVE)) { | ||
| 241 | xf86PostMotionEvent(local->dev, 0, 0, 2, | ||
| 242 | gs->dx, gs->dy); | ||
| 243 | TRACE2("motion: %d %d\n", gs->dx, gs->dy); | ||
| 244 | } | ||
| 245 | if (GETBIT(gs->type, GS_VSCROLL)) { | ||
| 246 | button_scroll(local, 4, 5, &vscroll, vscrollstep, gs->dy); | ||
| 247 | TRACE1("vscroll: %d\n", gs->dy); | ||
| 248 | } | ||
| 249 | if (GETBIT(gs->type, GS_HSCROLL)) { | ||
| 250 | button_scroll(local, 6, 7, &hscroll, hscrollstep, gs->dx); | ||
| 251 | TRACE1("hscroll: %d\n", gs->dx); | ||
| 252 | } | ||
| 253 | if (GETBIT(gs->type, GS_VSWIPE)) { | ||
| 254 | button_scroll(local, 8, 9, &vswipe, vswipestep, gs->dy); | ||
| 255 | TRACE1("vswipe: %d\n", gs->dy); | ||
| 256 | } | ||
| 257 | if (GETBIT(gs->type, GS_HSWIPE)) { | ||
| 258 | button_scroll(local, 10, 11, &hswipe, hswipestep, gs->dx); | ||
| 259 | TRACE1("hswipe: %d\n", gs->dx); | ||
| 260 | } | ||
| 261 | if (GETBIT(gs->type, GS_SCALE)) { | ||
| 262 | button_scroll(local, 12, 13, &scale, scalestep, gs->scale); | ||
| 263 | TRACE1("scale: %d\n", gs->scale); | ||
| 264 | } | ||
| 265 | if (GETBIT(gs->type, GS_ROTATE)) { | ||
| 266 | button_scroll(local, 14, 15, &rot, rotstep, gs->rot); | ||
| 267 | TRACE1("rotate: %d\n", gs->rot); | ||
| 268 | } | ||
| 269 | } | ||
| 270 | |||
| 271 | /* called for each full received packet from the touchpad */ | ||
| 272 | static void read_input(LocalDevicePtr local) | ||
| 273 | { | ||
| 274 | struct Gestures gs; | ||
| 275 | struct MTouch *mt = local->private; | ||
| 276 | while (read_synchronized_event(mt, local->fd)) { | ||
| 277 | parse_event(mt); | ||
| 278 | extract_gestures(&gs, mt); | ||
| 279 | handle_gestures(local, &gs, &mt->caps); | ||
| 280 | } | ||
| 281 | } | ||
| 282 | |||
| 283 | static Bool device_control(DeviceIntPtr dev, int mode) | ||
| 284 | { | ||
| 285 | LocalDevicePtr local = dev->public.devicePrivate; | ||
| 286 | switch (mode) { | ||
| 287 | case DEVICE_INIT: | ||
| 288 | xf86Msg(X_INFO, "device control: init\n"); | ||
| 289 | return device_init(dev, local); | ||
| 290 | case DEVICE_ON: | ||
| 291 | xf86Msg(X_INFO, "device control: on\n"); | ||
| 292 | return device_on(local); | ||
| 293 | case DEVICE_OFF: | ||
| 294 | xf86Msg(X_INFO, "device control: off\n"); | ||
| 295 | return device_off(local); | ||
| 296 | case DEVICE_CLOSE: | ||
| 297 | xf86Msg(X_INFO, "device control: close\n"); | ||
| 298 | return device_close(local); | ||
| 299 | default: | ||
| 300 | xf86Msg(X_INFO, "device control: default\n"); | ||
| 301 | return BadValue; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) | ||
| 307 | { | ||
| 308 | struct MTouch *mt; | ||
| 309 | InputInfoPtr local = xf86AllocateInput(drv, 0); | ||
| 310 | if (!local) | ||
| 311 | goto error; | ||
| 312 | mt = xcalloc(1, sizeof(struct MTouch)); | ||
| 313 | if (!mt) | ||
| 314 | goto error; | ||
| 315 | |||
| 316 | local->name = dev->identifier; | ||
| 317 | local->type_name = XI_TOUCHPAD; | ||
| 318 | local->device_control = device_control; | ||
| 319 | local->read_input = read_input; | ||
| 320 | local->private = mt; | ||
| 321 | local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; | ||
| 322 | local->conf_idev = dev; | ||
| 323 | |||
| 324 | xf86CollectInputOptions(local, NULL, NULL); | ||
| 325 | /* xf86OptionListReport(local->options); */ | ||
| 326 | xf86ProcessCommonOptions(local, local->options); | ||
| 327 | |||
| 328 | local->flags |= XI86_CONFIGURED; | ||
| 329 | error: | ||
| 330 | return local; | ||
| 331 | } | ||
| 332 | |||
| 333 | static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) | ||
| 334 | { | ||
| 335 | xfree(local->private); | ||
| 336 | local->private = 0; | ||
| 337 | xf86DeleteInput(local, 0); | ||
| 338 | } | ||
| 339 | |||
| 340 | static InputDriverRec MULTITOUCH = { | ||
| 341 | 1, | ||
| 342 | "multitouch", | ||
| 343 | NULL, | ||
| 344 | preinit, | ||
| 345 | uninit, | ||
| 346 | NULL, | ||
| 347 | 0 | ||
| 348 | }; | ||
| 349 | |||
| 350 | static XF86ModuleVersionInfo VERSION = { | ||
| 351 | "multitouch", | ||
| 352 | MODULEVENDORSTRING, | ||
| 353 | MODINFOSTRING1, | ||
| 354 | MODINFOSTRING2, | ||
| 355 | XORG_VERSION_CURRENT, | ||
| 356 | 0, 1, 0, | ||
| 357 | ABI_CLASS_XINPUT, | ||
| 358 | ABI_XINPUT_VERSION, | ||
| 359 | MOD_CLASS_XINPUT, | ||
| 360 | {0, 0, 0, 0} | ||
| 361 | }; | ||
| 362 | |||
| 363 | static pointer setup(pointer module, pointer options, int *errmaj, int *errmin) | ||
| 364 | { | ||
| 365 | xf86AddInputDriver(&MULTITOUCH, module, 0); | ||
| 366 | return module; | ||
| 367 | } | ||
| 368 | |||
| 369 | XF86ModuleData multitouchModuleData = {&VERSION, &setup, NULL }; | ||
| @@ -19,7 +19,8 @@ | |||
| 19 | * | 19 | * |
| 20 | **************************************************************************/ | 20 | **************************************************************************/ |
| 21 | 21 | ||
| 22 | #include "common.h" | 22 | #include <common.h> |
| 23 | #include <xbypass.h> | ||
| 23 | #include <stdio.h> | 24 | #include <stdio.h> |
| 24 | #include <time.h> | 25 | #include <time.h> |
| 25 | 26 | ||
