aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/capabilities.c181
-rw-r--r--src/capabilities.h57
-rw-r--r--src/common.h95
-rw-r--r--src/gestures.h43
-rw-r--r--src/hwdata.c133
-rw-r--r--src/hwdata.h95
-rw-r--r--src/hwstate.c2
-rw-r--r--src/hwstate.h47
-rw-r--r--src/iobuffer.c54
-rw-r--r--src/iobuffer.h38
-rw-r--r--src/memory.h73
-rw-r--r--src/mtouch.h59
-rw-r--r--src/mtstate.h62
-rw-r--r--src/multitouch.c369
-rw-r--r--src/test.c3
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#include "capabilities.h"
-
-#define SETABS(c, x, map, key, fd) \
- (c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd))
-
-#define ADDCAP(s, c, x) strcat(s, c->has_##x ? " " #x : "")
-
-#define CLICK_AREA(c) ((c->has_ibt ? 0.20 : 0.00) * get_cap_ysize(c))
-
-static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */
-static const int SN_WIDTH = 100; /* width signal-to-noise ratio */
-
-static const int bits_per_long = 8 * sizeof(long);
-
-static inline int nlongs(int nbit)
-{
- return (nbit + bits_per_long - 1) / bits_per_long;
-}
-
-static inline int getbit(const unsigned long *map, int key)
-{
- return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01;
-}
-
-static int getabs(struct input_absinfo *abs, int key, int fd)
-{
- int rc;
- SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs));
- return rc >= 0;
-}
-
-static int has_integrated_button(const struct Capabilities *cap)
-{
- static const int bcm5974_vmask_ibt = 1;
- if (strcmp(cap->devname, "bcm5974"))
- return 0;
- return cap->devid.version & bcm5974_vmask_ibt;
-}
-
-int read_capabilities(struct Capabilities *cap, int fd)
-{
- unsigned long evbits[nlongs(EV_MAX)];
- unsigned long absbits[nlongs(ABS_MAX)];
- unsigned long keybits[nlongs(KEY_MAX)];
- int rc;
-
- memset(cap, 0, sizeof(struct Capabilities));
-
- SYSCALL(rc = ioctl(fd, EVIOCGID, &cap->devid));
- if (rc < 0)
- return rc;
- SYSCALL(rc = ioctl(fd, EVIOCGNAME(sizeof(cap->devname)), cap->devname));
- if (rc < 0)
- return rc;
- SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_SYN, sizeof(evbits)), evbits));
- if (rc < 0)
- return rc;
- SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
- if (rc < 0)
- return rc;
- SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
- if (rc < 0)
- return rc;
-
- cap->has_left = getbit(keybits, BTN_LEFT);
- cap->has_middle = getbit(keybits, BTN_MIDDLE);
- cap->has_right = getbit(keybits, BTN_RIGHT);
-
- SETABS(cap, touch_major, absbits, ABS_MT_TOUCH_MAJOR, fd);
- SETABS(cap, touch_minor, absbits, ABS_MT_TOUCH_MINOR, fd);
- SETABS(cap, width_major, absbits, ABS_MT_WIDTH_MAJOR, fd);
- SETABS(cap, width_minor, absbits, ABS_MT_WIDTH_MINOR, fd);
- SETABS(cap, orientation, absbits, ABS_MT_ORIENTATION, fd);
- SETABS(cap, position_x, absbits, ABS_MT_POSITION_X, fd);
- SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd);
-
- cap->has_mtdata = cap->has_position_x && cap->has_position_y;
- cap->has_ibt = has_integrated_button(cap);
-
- cap->xfuzz = cap->abs_position_x.fuzz;
- cap->yfuzz = cap->abs_position_y.fuzz;
- if (cap->xfuzz <= 0 || cap->yfuzz <= 0) {
- cap->xfuzz = get_cap_xsize(cap) / SN_COORD;
- cap->yfuzz = get_cap_ysize(cap) / SN_COORD;
- }
- cap->wfuzz = cap->abs_touch_major.fuzz;
- if (cap->wfuzz <= 0)
- cap->wfuzz = get_cap_wsize(cap) / SN_WIDTH;
-
- cap->yclick = cap->abs_position_y.maximum - CLICK_AREA(cap);
-
- return 0;
-}
-
-int get_cap_xsize(const struct Capabilities *cap)
-{
- return cap->abs_position_x.maximum - cap->abs_position_x.minimum;
-}
-
-int get_cap_ysize(const struct Capabilities *cap)
-{
- return cap->abs_position_y.maximum - cap->abs_position_y.minimum;
-}
-
-int get_cap_wsize(const struct Capabilities *cap)
-{
- return cap->abs_touch_major.maximum - cap->abs_touch_major.minimum;
-}
-
-int get_cap_xmid(const struct Capabilities *cap)
-{
- return (cap->abs_position_x.maximum + cap->abs_position_x.minimum) >> 1;
-}
-
-int get_cap_ymid(const struct Capabilities *cap)
-{
- return (cap->abs_position_y.maximum + cap->abs_position_y.minimum) >> 1;
-}
-
-void output_capabilities(const struct Capabilities *cap)
-{
- char line[1024];
- memset(line, 0, sizeof(line));
- ADDCAP(line, cap, left);
- ADDCAP(line, cap, middle);
- ADDCAP(line, cap, right);
- ADDCAP(line, cap, mtdata);
- ADDCAP(line, cap, ibt);
- ADDCAP(line, cap, touch_major);
- ADDCAP(line, cap, touch_minor);
- ADDCAP(line, cap, width_major);
- ADDCAP(line, cap, width_minor);
- ADDCAP(line, cap, orientation);
- ADDCAP(line, cap, position_x);
- ADDCAP(line, cap, position_y);
- xf86Msg(X_INFO, "multitouch: devname: %s\n", cap->devname);
- xf86Msg(X_INFO, "multitouch: devid: %x %x %x\n",
- cap->devid.vendor, cap->devid.product, cap->devid.version);
- xf86Msg(X_INFO, "multitouch: caps:%s\n", line);
- if (cap->has_touch_major)
- xf86Msg(X_INFO, "multitouch: touch: %d %d\n",
- cap->abs_touch_major.minimum,
- cap->abs_touch_major.maximum);
- if (cap->has_width_major)
- xf86Msg(X_INFO, "multitouch: width: %d %d\n",
- cap->abs_width_major.minimum,
- cap->abs_width_major.maximum);
- if (cap->has_orientation)
- xf86Msg(X_INFO, "multitouch: orientation: %d %d\n",
- cap->abs_orientation.minimum,
- cap->abs_orientation.maximum);
- if (cap->has_position_x)
- xf86Msg(X_INFO, "multitouch: position_x: %d %d\n",
- cap->abs_position_x.minimum,
- cap->abs_position_x.maximum);
- if (cap->has_position_y)
- xf86Msg(X_INFO, "multitouch: position_y: %d %d\n",
- cap->abs_position_y.minimum,
- cap->abs_position_y.maximum);
-}
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef CAPABILITIES_H
-#define CAPABILITIES_H
-
-#include "common.h"
-
-struct Capabilities {
- struct input_id devid;
- char devname[32];
- int has_left, has_middle;
- int has_right, has_mtdata, has_ibt;
- int has_touch_major, has_touch_minor;
- int has_width_major, has_width_minor;
- int has_orientation, has_dummy;
- int has_position_x, has_position_y;
- struct input_absinfo abs_touch_major;
- struct input_absinfo abs_touch_minor;
- struct input_absinfo abs_width_major;
- struct input_absinfo abs_width_minor;
- struct input_absinfo abs_orientation;
- struct input_absinfo abs_position_x;
- struct input_absinfo abs_position_y;
- int xfuzz, yfuzz, wfuzz;
- int yclick;
-};
-
-int read_capabilities(struct Capabilities *cap, int fd);
-int get_cap_xsize(const struct Capabilities *cap);
-int get_cap_ysize(const struct Capabilities *cap);
-int get_cap_wsize(const struct Capabilities *cap);
-
-int get_cap_xmid(const struct Capabilities *cap);
-int get_cap_ymid(const struct Capabilities *cap);
-
-void output_capabilities(const struct Capabilities *cap);
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef COMMON_H
-#define COMMON_H
-
-#include "xorg-server.h"
-#include <xf86.h>
-#include <xf86_OSproc.h>
-#include <xf86Xinput.h>
-#include <linux/input.h>
-#include <errno.h>
-#include <match/match.h>
-
-/* includes available in 2.6.30-rc5 */
-
-#ifndef BTN_TOOL_QUADTAP
-#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
-#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
-#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
-#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
-#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
-#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
-#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
-#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
-#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
-#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
-#define SYN_MT_REPORT 2
-#define MT_TOOL_FINGER 0
-#define MT_TOOL_PEN 1
-#endif
-
-/* includes available in 2.6.33 */
-#ifndef ABS_MT_PRESSURE
-#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
-#endif
-
-#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
-
-#define BITMASK(x) (1U << (x))
-#define BITONES(x) (BITMASK(x) - 1U)
-#define GETBIT(m, x) (((m) >> (x)) & 1U)
-#define SETBIT(m, x) (m |= BITMASK(x))
-#define CLEARBIT(m, x) (m &= ~BITMASK(x))
-
-static inline int maxval(int x, int y) { return x > y ? x : y; }
-static inline int minval(int x, int y) { return x < y ? x : y; }
-
-static inline int clamp15(int x)
-{
- return x < -32767 ? -32767 : x > 32767 ? 32767 : x;
-}
-
-/* absolute scale is assumed to fit in 15 bits */
-static inline int dist2(int dx, int dy)
-{
- dx = clamp15(dx);
- dy = clamp15(dy);
- return dx * dx + dy * dy;
-}
-
-/* Count number of bits (Sean Eron Andersson's Bit Hacks) */
-static inline int bitcount(unsigned v)
-{
- v -= ((v>>1) & 0x55555555);
- v = (v&0x33333333) + ((v>>2) & 0x33333333);
- return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24;
-}
-
-/* Return index of first bit [0-31], -1 on zero */
-#define firstbit(v) (__builtin_ffs(v) - 1)
-
-/* boost-style foreach bit */
-#define foreach_bit(i, m) \
- for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << i + 1)))
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef GESTURES_H
-#define GESTURES_H
-
-#include "mtouch.h"
-
-#define GS_BUTTON 0
-#define GS_MOVE 1
-#define GS_VSCROLL 2
-#define GS_HSCROLL 3
-#define GS_VSWIPE 4
-#define GS_HSWIPE 5
-#define GS_SCALE 6
-#define GS_ROTATE 7
-
-struct Gestures {
- unsigned type, btmask, btdata;
- int same_fingers, dx, dy, scale, rot;
-};
-
-void extract_gestures(struct Gestures *gs, struct MTouch* mt);
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#include "hwdata.h"
-
-void init_hwdata(struct HWData *hw)
-{
- memset(hw, 0, sizeof(struct HWData));
-}
-
-static void set_value(struct HWData *hw, int code, int value)
-{
- if (hw->nread < DIM_FINGER) {
- (&hw->finger[hw->nread].touch_major)[code] = value;
- SETBIT(hw->mread[hw->nread], code);
- }
- hw->mtread++;
-}
-
-static void accept_finger(struct HWData *hw)
-{
- if (hw->nread < DIM_FINGER &&
- GETBIT(hw->mread[hw->nread], BIT_MT_POSITION_X) &&
- GETBIT(hw->mread[hw->nread], BIT_MT_POSITION_Y)) {
- hw->mask[hw->nread] = hw->mread[hw->nread];
- hw->nread++;
- }
- if (hw->nread < DIM_FINGER)
- hw->mread[hw->nread] = 0;
-}
-
-static void accept_packet(struct HWData *hw, const struct timeval* tv)
-{
- static const mstime_t ms = 1000;
- if (hw->mtread)
- hw->nfinger = hw->nread;
- hw->mtread = 0;
- hw->nread = 0;
- hw->mread[hw->nread] = 0;
- hw->evtime = tv->tv_usec / ms + tv->tv_sec * ms;
-}
-
-int read_hwdata(struct HWData *hw, const struct input_event* ev)
-{
- switch (ev->type) {
- case EV_SYN:
- switch (ev->code) {
- case SYN_REPORT:
- accept_packet(hw, &ev->time);
- return 1;
- case SYN_MT_REPORT:
- accept_finger(hw);
- break;
- }
- break;
- case EV_KEY:
- switch (ev->code) {
- case BTN_TOUCH:
- hw->mtread++;
- break;
- case BTN_LEFT:
- if (ev->value)
- SETBIT(hw->button, MT_BUTTON_LEFT);
- else
- CLEARBIT(hw->button, MT_BUTTON_LEFT);
- break;
- case BTN_MIDDLE:
- if (ev->value)
- SETBIT(hw->button, MT_BUTTON_MIDDLE);
- else
- CLEARBIT(hw->button, MT_BUTTON_MIDDLE);
- break;
- case BTN_RIGHT:
- if (ev->value)
- SETBIT(hw->button, MT_BUTTON_RIGHT);
- else
- CLEARBIT(hw->button, MT_BUTTON_RIGHT);
- break;
- }
- break;
- case EV_ABS:
- switch (ev->code) {
- case ABS_MT_TOUCH_MAJOR:
- set_value(hw, BIT_MT_TOUCH_MAJOR, ev->value);
- break;
- case ABS_MT_TOUCH_MINOR:
- set_value(hw, BIT_MT_TOUCH_MINOR, ev->value);
- break;
- case ABS_MT_WIDTH_MAJOR:
- set_value(hw, BIT_MT_WIDTH_MAJOR, ev->value);
- break;
- case ABS_MT_WIDTH_MINOR:
- set_value(hw, BIT_MT_WIDTH_MINOR, ev->value);
- break;
- case ABS_MT_ORIENTATION:
- set_value(hw, BIT_MT_ORIENTATION, ev->value);
- break;
- case ABS_MT_PRESSURE:
- set_value(hw, BIT_MT_PRESSURE, ev->value);
- break;
- case ABS_MT_POSITION_X:
- set_value(hw, BIT_MT_POSITION_X, ev->value);
- break;
- case ABS_MT_POSITION_Y:
- set_value(hw, BIT_MT_POSITION_Y, ev->value);
- break;
- }
- break;
- }
- return 0;
-}
-
-void output_hwdata(const struct HWData *hw)
-{
-}
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef HWDATA_H
-#define HWDATA_H
-
-#include "common.h"
-
-#define DIM_BUTTON 15
-
-#define MT_BUTTON_LEFT 0
-#define MT_BUTTON_MIDDLE 1
-#define MT_BUTTON_RIGHT 2
-#define MT_BUTTON_WHEEL_UP 3
-#define MT_BUTTON_WHEEL_DOWN 4
-#define MT_BUTTON_HWHEEL_LEFT 5
-#define MT_BUTTON_HWHEEL_RIGHT 6
-#define MT_BUTTON_SWIPE_UP 7
-#define MT_BUTTON_SWIPE_DOWN 8
-#define MT_BUTTON_SWIPE_LEFT 9
-#define MT_BUTTON_SWIPE_RIGHT 10
-#define MT_BUTTON_SCALE_DOWN 11
-#define MT_BUTTON_SCALE_UP 12
-#define MT_BUTTON_ROTATE_LEFT 13
-#define MT_BUTTON_ROTATE_RIGHT 14
-
-#define BIT_MT_TOUCH_MAJOR 0
-#define BIT_MT_TOUCH_MINOR 1
-#define BIT_MT_WIDTH_MAJOR 2
-#define BIT_MT_WIDTH_MINOR 3
-#define BIT_MT_ORIENTATION 4
-#define BIT_MT_PRESSURE 5
-#define BIT_MT_POSITION_X 6
-#define BIT_MT_POSITION_Y 7
-#define BIT_MT_CNT 8
-
-struct FingerData {
- int touch_major, touch_minor;
- int width_major, width_minor;
- int orientation, pressure;
- int position_x, position_y;
-};
-
-/* year-proof millisecond event time */
-typedef __u64 mstime_t;
-
-/**
- * struct HWData - hardware reads
- *
- * @finger: finger data
- * @mask: bits corresponding to data actually read (readonly)
- * @mread: bits corresponding to data in progress (writeonly)
- * @button: bitmask of buttons
- * @nfinger: number of fingers actually read (readonly)
- * @nread: number of fingers in progress (writeonly)
- *
- */
-struct HWData {
- struct FingerData finger[DIM_FINGER];
- unsigned mask[DIM_FINGER], mread[DIM_FINGER];
- unsigned button;
- int nfinger, mtread, nread;
- mstime_t evtime;
-};
-
-void init_hwdata(struct HWData *hw);
-int read_hwdata(struct HWData *hw, const struct input_event* ev);
-void output_hwdata(const struct HWData *hw);
-
-static inline int finger_dist2(const struct FingerData *a,
- const struct FingerData *b)
-{
- return dist2(a->position_x - b->position_x,
- a->position_y - b->position_y);
-}
-
-#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 @@
**************************************************************************/
#include "hwstate.h"
-#include <stdlib.h>
-#include <limits.h>
#define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major)
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef MTEVENT_H
-#define MTEVENT_H
-
-#include "capabilities.h"
-#include "hwdata.h"
-
-/* zero id means not mapped (not touching) */
-struct FingerState {
- struct FingerData hw;
- int id;
-};
-
-struct HWState {
- struct FingerState finger[DIM_FINGER];
- unsigned button;
- int nfinger;
- mstime_t evtime;
- int lastid;
-};
-
-void init_hwstate(struct HWState *s);
-void modify_hwstate(struct HWState *s,
- const struct HWData *hw,
- const struct Capabilities *caps);
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#include "iobuffer.h"
-
-void init_iobuf(struct IOBuffer *buf)
-{
- memset(buf, 0, sizeof(struct IOBuffer));
- buf->at = buf->begin;
- buf->top = buf->at;
- buf->end = buf->begin + DIM_BUFFER;
-}
-
-const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd)
-{
- const struct input_event *ev;
- int n = buf->top - buf->at;
- if (n < EVENT_SIZE) {
- /* partial event is available: save it */
- if (buf->at != buf->begin && n > 0)
- memmove(buf->begin, buf->at, n);
- /* start from the beginning */
- buf->at = buf->begin;
- buf->top = buf->at + n;
- /* read more data */
- SYSCALL(n = read(fd, buf->top, buf->end - buf->top));
- if (n <= 0)
- return NULL;
- buf->top += n;
- }
- if (buf->top - buf->at < EVENT_SIZE)
- return NULL;
- ev = (const struct input_event *)buf->at;
- buf->at += EVENT_SIZE;
- return ev;
-}
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef IOBUFFER_H
-#define IOBUFFER_H
-
-#include "common.h"
-
-#define EVENT_SIZE sizeof(struct input_event)
-#define DIM_EVENTS 64
-#define DIM_BUFFER (DIM_EVENTS * EVENT_SIZE)
-
-struct IOBuffer {
- char begin[DIM_BUFFER], *at, *top, *end;
-};
-
-void init_iobuf(struct IOBuffer *buf);
-const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd);
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef MEMORY_H
-#define MEMORY_H
-
-#include "mtstate.h"
-
-/**
- * struct Memory - parsing state
- *
- * @btdata: logical finger state
- * @same: true if the finger configuration is unchanged
- * @fingers: bitmask of fingers on the pad
- * @added: bitmask of new fingers on the pad
- * @thumb: bitmask of thumbs on the pad
- * @pointing: bitmask of pointing fingers
- * @pending: bitmask of tentatively moving fingers
- * @moving: bitmask of moving fingers
- * @ybar: vertical position on pad marking the clicking area
- * @mvhold: movement before this point in time is accumulated
- * @mvforget: movement before this point in time is discarded
- * @dx: array of accumulated horiontal movement per finger
- * @dy: array of accumulated vertical movement per finger
- *
- */
-struct Memory {
- unsigned btdata, same;
- unsigned fingers, added, thumb;
- unsigned pointing, pending, moving;
- int ybar;
- mstime_t mvhold, mvforget;
- int dx[DIM_FINGER], dy[DIM_FINGER];
-};
-
-void init_memory(struct Memory *mem);
-void refresh_memory(struct Memory *m,
- const struct MTState *prev_state,
- const struct MTState *state,
- const struct Capabilities *caps);
-void output_memory(const struct Memory *m);
-
-static inline void mem_hold_movement(struct Memory *m, mstime_t t)
-{
- if (t > m->mvhold)
- m->mvhold = t;
-}
-
-static inline void mem_forget_movement(struct Memory *m, mstime_t t)
-{
- if (t > m->mvforget)
- m->mvforget = t;
-}
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef MTOUCH_H
-#define MTOUCH_H
-
-#include "capabilities.h"
-#include "iobuffer.h"
-#include "hwdata.h"
-#include "hwstate.h"
-#include "mtstate.h"
-#include "memory.h"
-
-struct MTouch {
- struct Capabilities caps;
- struct IOBuffer buf;
- struct HWData hw;
- struct HWState hs;
- struct MTState prev_state, state;
- struct Memory mem;
-};
-
-int configure_mtouch(struct MTouch *mt, int fd);
-int open_mtouch(struct MTouch *mt, int fd);
-int close_mtouch(struct MTouch *mt, int fd);
-
-int read_synchronized_event(struct MTouch *mt, int fd);
-void parse_event(struct MTouch *mt);
-
-
-static inline void mt_delay_movement(struct MTouch *mt, int t)
-{
- mem_hold_movement(&mt->mem, mt->state.evtime + t);
-}
-
-static inline void mt_skip_movement(struct MTouch *mt, int t)
-{
- mem_forget_movement(&mt->mem, mt->state.evtime + t);
-}
-
-#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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#ifndef MTSTATE_H
-#define MTSTATE_H
-
-#include "hwstate.h"
-
-struct MTFinger {
- struct FingerData hw;
- int id, thumb;
-};
-
-struct MTState {
- struct MTFinger finger[DIM_FINGER];
- int nfinger;
- unsigned button;
- mstime_t evtime;
-};
-
-void init_mtstate(struct MTState *s);
-void extract_mtstate(struct MTState *s,
- const struct HWState *hs,
- const struct Capabilities *caps);
-void output_mtstate(const struct MTState *s);
-
-const struct MTFinger *find_finger(const struct MTState *s, int id);
-
-
-static inline int center_dist2(const struct MTFinger *a,
- const struct Capabilities *caps)
-{
- return dist2(a->hw.position_x - get_cap_xmid(caps),
- a->hw.position_y - get_cap_ymid(caps));
-}
-
-static inline int center_maxdist2(const struct Capabilities *caps)
-{
- return dist2(caps->abs_position_x.maximum - get_cap_xmid(caps),
- caps->abs_position_y.maximum - get_cap_ymid(caps));
-}
-
-#endif
-
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 @@
-/***************************************************************************
- *
- * Multitouch X driver
- * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#include "gestures.h"
-
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
-#include <X11/Xatom.h>
-#include <xserver-properties.h>
-#endif
-
-/* these should be user-configurable at some point */
-static const float vscroll_fraction = 0.05;
-static const float hscroll_fraction = 0.05;
-static const float vswipe_fraction = 0.25;
-static const float hswipe_fraction = 0.25;
-static const float scale_fraction = 0.05;
-static const float rot_fraction = 0.05;
-
-/* flip these to enable event debugging */
-#if 1
-#define TRACE1(format, arg1)
-#define TRACE2(format, arg1, arg2)
-#else
-#define TRACE1(format, arg1) xf86Msg(X_INFO, format, arg1)
-#define TRACE2(format, arg1, arg2) xf86Msg(X_INFO, format, arg1, arg2)
-#endif
-
-/* button mapping simplified */
-#define PROPMAP(m, x, y) m[x] = XIGetKnownProperty(y)
-
-static void pointer_control(DeviceIntPtr dev, PtrCtrl *ctrl)
-{
- xf86Msg(X_INFO, "pointer_control\n");
-}
-
-static int pointer_property(DeviceIntPtr dev,
- Atom property,
- XIPropertyValuePtr prop,
- BOOL checkonly)
-{
- xf86Msg(X_INFO, "pointer_property\n");
- return Success;
-}
-
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
-static void initAxesLabels(Atom map[2])
-{
- memset(map, 0, 2 * sizeof(Atom));
- PROPMAP(map, 0, AXIS_LABEL_PROP_REL_X);
- PROPMAP(map, 1, AXIS_LABEL_PROP_REL_Y);
-}
-
-static void initButtonLabels(Atom map[DIM_BUTTON])
-{
- memset(map, 0, DIM_BUTTON * sizeof(Atom));
- PROPMAP(map, MT_BUTTON_LEFT, BTN_LABEL_PROP_BTN_LEFT);
- PROPMAP(map, MT_BUTTON_MIDDLE, BTN_LABEL_PROP_BTN_MIDDLE);
- PROPMAP(map, MT_BUTTON_RIGHT, BTN_LABEL_PROP_BTN_RIGHT);
- PROPMAP(map, MT_BUTTON_WHEEL_UP, BTN_LABEL_PROP_BTN_WHEEL_UP);
- PROPMAP(map, MT_BUTTON_WHEEL_DOWN, BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- PROPMAP(map, MT_BUTTON_HWHEEL_LEFT, BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- PROPMAP(map, MT_BUTTON_HWHEEL_RIGHT, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
- /* how to map swipe buttons? */
- PROPMAP(map, MT_BUTTON_SWIPE_UP, BTN_LABEL_PROP_BTN_0);
- PROPMAP(map, MT_BUTTON_SWIPE_DOWN, BTN_LABEL_PROP_BTN_1);
- PROPMAP(map, MT_BUTTON_SWIPE_LEFT, BTN_LABEL_PROP_BTN_2);
- PROPMAP(map, MT_BUTTON_SWIPE_RIGHT, BTN_LABEL_PROP_BTN_3);
- /* how to map scale and rotate? */
- PROPMAP(map, MT_BUTTON_SCALE_DOWN, BTN_LABEL_PROP_BTN_4);
- PROPMAP(map, MT_BUTTON_SCALE_UP, BTN_LABEL_PROP_BTN_5);
- PROPMAP(map, MT_BUTTON_ROTATE_LEFT, BTN_LABEL_PROP_BTN_6);
- PROPMAP(map, MT_BUTTON_ROTATE_RIGHT, BTN_LABEL_PROP_BTN_7);
-}
-#endif
-
-static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
-{
- struct MTouch *mt = local->private;
- unsigned char btmap[DIM_BUTTON + 1] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
- };
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- Atom axes_labels[2], btn_labels[DIM_BUTTON];
- initAxesLabels(axes_labels);
- initButtonLabels(btn_labels);
-#endif
-
- local->fd = xf86OpenSerial(local->options);
- if (local->fd < 0) {
- xf86Msg(X_ERROR, "multitouch: cannot open device\n");
- return !Success;
- }
- if (configure_mtouch(mt, local->fd)) {
- xf86Msg(X_ERROR, "multitouch: cannot configure device\n");
- return !Success;
- }
- xf86CloseSerial(local->fd);
-
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
- InitPointerDeviceStruct((DevicePtr)dev,
- btmap, DIM_BUTTON,
- GetMotionHistory,
- pointer_control,
- GetMotionHistorySize(),
- 2);
-#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 7
- InitPointerDeviceStruct((DevicePtr)dev,
- btmap, DIM_BUTTON,
- pointer_control,
- GetMotionHistorySize(),
- 2);
-#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- InitPointerDeviceStruct((DevicePtr)dev,
- btmap, DIM_BUTTON, btn_labels,
- pointer_control,
- GetMotionHistorySize(),
- 2, axes_labels);
-#else
-#error "Unsupported ABI_XINPUT_VERSION"
-#endif
-
- xf86InitValuatorAxisStruct(dev, 0,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axes_labels[0],
-#endif
- mt->caps.abs_position_x.minimum,
- mt->caps.abs_position_x.maximum,
- 1, 0, 1);
- xf86InitValuatorDefaults(dev, 0);
- xf86InitValuatorAxisStruct(dev, 1,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- axes_labels[1],
-#endif
- mt->caps.abs_position_y.minimum,
- mt->caps.abs_position_y.maximum,
- 1, 0, 1);
- xf86InitValuatorDefaults(dev, 1);
-
- XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL);
-
- return Success;
-}
-
-static int device_on(LocalDevicePtr local)
-{
- struct MTouch *mt = local->private;
- local->fd = xf86OpenSerial(local->options);
- if (local->fd < 0) {
- xf86Msg(X_ERROR, "multitouch: cannot open device\n");
- return !Success;
- }
- if (open_mtouch(mt, local->fd)) {
- xf86Msg(X_ERROR, "multitouch: cannot grab device\n");
- return !Success;
- }
- xf86AddEnabledDevice(local);
- return Success;
-}
-
-static int device_off(LocalDevicePtr local)
-{
- struct MTouch *mt = local->private;
- xf86RemoveEnabledDevice(local);
- if (close_mtouch(mt, local->fd))
- xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n");
- xf86CloseSerial(local->fd);
- return Success;
-}
-
-static int device_close(LocalDevicePtr local)
-{
- return Success;
-}
-
-static void tickle_button(LocalDevicePtr local, int id)
-{
- xf86PostButtonEvent(local->dev, FALSE, id, 1, 0, 0);
- xf86PostButtonEvent(local->dev, FALSE, id, 0, 0, 0);
-}
-
-static void button_scroll(LocalDevicePtr local,
- int btdec, int btinc,
- int *scroll, int step,
- int delta)
-{
- *scroll += delta;
- while (*scroll > step) {
- tickle_button(local, btinc);
- *scroll -= step;
- }
- while (*scroll < -step) {
- tickle_button(local, btdec);
- *scroll += step;
- }
-}
-
-static void handle_gestures(LocalDevicePtr local,
- const struct Gestures *gs,
- const struct Capabilities *caps)
-{
- static int vscroll, hscroll, vswipe, hswipe, scale, rot;
- int vscrollstep = 1 + vscroll_fraction * get_cap_ysize(caps);
- int hscrollstep = 1 + hscroll_fraction * get_cap_xsize(caps);
- int vswipestep = 1 + vswipe_fraction * get_cap_ysize(caps);
- int hswipestep = 1 + hswipe_fraction * get_cap_xsize(caps);
- int scalestep = 1 + scale_fraction * get_cap_xsize(caps);
- int rotstep = 1 + rot_fraction * get_cap_xsize(caps);
- int i;
- if (!gs->same_fingers) {
- vscroll = 0;
- hscroll = 0;
- vswipe = 0;
- hswipe = 0;
- }
- for (i = 0; i < DIM_BUTTON; i++) {
- if (GETBIT(gs->btmask, i)) {
- xf86PostButtonEvent(local->dev, FALSE,
- i + 1, GETBIT(gs->btdata, i), 0, 0);
- TRACE2("button bit: %d %d\n", i, GETBIT(gs->btdata, i));
- }
- }
- if (GETBIT(gs->type, GS_MOVE)) {
- xf86PostMotionEvent(local->dev, 0, 0, 2,
- gs->dx, gs->dy);
- TRACE2("motion: %d %d\n", gs->dx, gs->dy);
- }
- if (GETBIT(gs->type, GS_VSCROLL)) {
- button_scroll(local, 4, 5, &vscroll, vscrollstep, gs->dy);
- TRACE1("vscroll: %d\n", gs->dy);
- }
- if (GETBIT(gs->type, GS_HSCROLL)) {
- button_scroll(local, 6, 7, &hscroll, hscrollstep, gs->dx);
- TRACE1("hscroll: %d\n", gs->dx);
- }
- if (GETBIT(gs->type, GS_VSWIPE)) {
- button_scroll(local, 8, 9, &vswipe, vswipestep, gs->dy);
- TRACE1("vswipe: %d\n", gs->dy);
- }
- if (GETBIT(gs->type, GS_HSWIPE)) {
- button_scroll(local, 10, 11, &hswipe, hswipestep, gs->dx);
- TRACE1("hswipe: %d\n", gs->dx);
- }
- if (GETBIT(gs->type, GS_SCALE)) {
- button_scroll(local, 12, 13, &scale, scalestep, gs->scale);
- TRACE1("scale: %d\n", gs->scale);
- }
- if (GETBIT(gs->type, GS_ROTATE)) {
- button_scroll(local, 14, 15, &rot, rotstep, gs->rot);
- TRACE1("rotate: %d\n", gs->rot);
- }
-}
-
-/* called for each full received packet from the touchpad */
-static void read_input(LocalDevicePtr local)
-{
- struct Gestures gs;
- struct MTouch *mt = local->private;
- while (read_synchronized_event(mt, local->fd)) {
- parse_event(mt);
- extract_gestures(&gs, mt);
- handle_gestures(local, &gs, &mt->caps);
- }
-}
-
-static Bool device_control(DeviceIntPtr dev, int mode)
-{
- LocalDevicePtr local = dev->public.devicePrivate;
- switch (mode) {
- case DEVICE_INIT:
- xf86Msg(X_INFO, "device control: init\n");
- return device_init(dev, local);
- case DEVICE_ON:
- xf86Msg(X_INFO, "device control: on\n");
- return device_on(local);
- case DEVICE_OFF:
- xf86Msg(X_INFO, "device control: off\n");
- return device_off(local);
- case DEVICE_CLOSE:
- xf86Msg(X_INFO, "device control: close\n");
- return device_close(local);
- default:
- xf86Msg(X_INFO, "device control: default\n");
- return BadValue;
- }
-}
-
-
-static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags)
-{
- struct MTouch *mt;
- InputInfoPtr local = xf86AllocateInput(drv, 0);
- if (!local)
- goto error;
- mt = xcalloc(1, sizeof(struct MTouch));
- if (!mt)
- goto error;
-
- local->name = dev->identifier;
- local->type_name = XI_TOUCHPAD;
- local->device_control = device_control;
- local->read_input = read_input;
- local->private = mt;
- local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
- local->conf_idev = dev;
-
- xf86CollectInputOptions(local, NULL, NULL);
- /* xf86OptionListReport(local->options); */
- xf86ProcessCommonOptions(local, local->options);
-
- local->flags |= XI86_CONFIGURED;
- error:
- return local;
-}
-
-static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags)
-{
- xfree(local->private);
- local->private = 0;
- xf86DeleteInput(local, 0);
-}
-
-static InputDriverRec MULTITOUCH = {
- 1,
- "multitouch",
- NULL,
- preinit,
- uninit,
- NULL,
- 0
-};
-
-static XF86ModuleVersionInfo VERSION = {
- "multitouch",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 0, 1, 0,
- ABI_CLASS_XINPUT,
- ABI_XINPUT_VERSION,
- MOD_CLASS_XINPUT,
- {0, 0, 0, 0}
-};
-
-static pointer setup(pointer module, pointer options, int *errmaj, int *errmin)
-{
- xf86AddInputDriver(&MULTITOUCH, module, 0);
- return module;
-}
-
-XF86ModuleData multitouchModuleData = {&VERSION, &setup, NULL };
diff --git a/src/test.c b/src/test.c
index fc16201..7d983a0 100644
--- a/src/test.c
+++ b/src/test.c
@@ -19,7 +19,8 @@
*
**************************************************************************/
-#include "common.h"
+#include <common.h>
+#include <xbypass.h>
#include <stdio.h>
#include <time.h>