diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2012-01-18 00:37:50 +0100 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2012-01-19 17:40:42 -0800 |
commit | 89588cb3cc2fdde6250dc84f9b23bb72bff57dde (patch) | |
tree | 2015faa41ece277283ce3991df48ef11d0fe122f | |
parent | 1a6a4088170b1b08cb763529006b077b88ec4fec (diff) |
eventcomm: Read evdev events from mtdev where multitouch is available
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | src/eventcomm.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 4752568..f26bfeb 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -66,6 +66,7 @@ struct eventcomm_proto_data */ BOOL need_grab; #ifdef HAVE_MTDEV + struct mtdev *mtdev; int axis_map[MT_ABS_SIZE]; #endif }; @@ -89,6 +90,16 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) proto_data->need_grab = FALSE; +#ifdef HAVE_MTDEV + proto_data->mtdev = mtdev_new_open(pInfo->fd); + if (!proto_data->mtdev) + { + xf86IDrvMsg(pInfo, X_WARNING, + "failed to create mtdev instance, ignoring touch events\n"); + priv->has_touch = FALSE; + } +#endif + return TRUE; } @@ -354,10 +365,20 @@ EventQueryHardware(InputInfoPtr pInfo) static Bool SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev) { +#ifdef HAVE_MTDEV + SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; + struct eventcomm_proto_data *proto_data = priv->proto_data; +#endif int rc = TRUE; ssize_t len; - len = read(pInfo->fd, ev, sizeof(*ev)); +#ifdef HAVE_MTDEV + if (proto_data && proto_data->mtdev) + len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) * + sizeof(struct input_event); + else +#endif + len = read(pInfo->fd, ev, sizeof(*ev)); if (len <= 0) { /* We use X_NONE here because it doesn't alloc */ |