From 7db9d8d76ff61c4802ac15559dcea6fa54ff567a Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Fri, 6 Aug 2010 21:11:17 +0200 Subject: initial bzr repo at rev 27 --- include/grail-touch.h | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 include/grail-touch.h (limited to 'include/grail-touch.h') diff --git a/include/grail-touch.h b/include/grail-touch.h new file mode 100644 index 0000000..5c2fab0 --- /dev/null +++ b/include/grail-touch.h @@ -0,0 +1,107 @@ +/***************************************************************************** + * + * grail - Gesture Recognition And Instantiation Library + * + * Copyright (C) 2010 Canonical Ltd. + * + * 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 3 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, see . + * + * Authors: + * Henrik Rydberg + * + ****************************************************************************/ + +#ifndef _GRAIL_TOUCH_H +#define _GRAIL_TOUCH_H + +#include +#include + +#define DIM_TOUCH 32 +#define DIM_TOUCH_BYTES ((DIM_TOUCH + 7) >> 3) + +typedef int touch_prop_t; +typedef __u64 touch_time_t; + +enum touch_prop_list { + TP_POS_X, + TP_POS_Y, + TP_TOUCH_MAJOR, + TP_TOUCH_MINOR, + TP_WIDTH_MAJOR, + TP_WIDTH_MINOR, + TP_ORIENTATION, + TP_PRESSURE, + DIM_TOUCH_PROP +}; + +#define DIM_TOUCH_PROP_BYTES ((DIM_TOUCH_PROP + 7) >> 3) + +struct touch { + int active; + int slot; + touch_prop_t prop[DIM_TOUCH_PROP]; +}; + +struct touch_frame { + int nactive; + int ncreate, nmodify, ndestroy; + touch_time_t time; + grail_mask_t touches[DIM_TOUCH_BYTES]; + struct touch *active[DIM_TOUCH]; + struct touch touch[DIM_TOUCH]; +}; + +struct touch_dev_caps { + grail_mask_t mask[DIM_TOUCH_PROP_BYTES]; + struct input_absinfo info[DIM_TOUCH_PROP]; +}; + +struct touch_dev { + void (*event)(struct touch_dev *dev, const struct input_event *ev); + void (*create)(struct touch_dev *dev, int slot, + const grail_mask_t *mask, const touch_prop_t *prop); + void (*modify)(struct touch_dev *dev, int slot, + const grail_mask_t *mask, const touch_prop_t *prop); + void (*destroy)(struct touch_dev *dev, int slot); + void (*sync)(struct touch_dev *dev, const struct input_event *syn); + struct touch_dev_caps caps; + struct touch_dev_impl *impl; + void *priv; +}; + +struct touch_engine { + void (*event)(struct touch_engine *engine, + const struct input_event *ev); + void (*sync)(struct touch_engine *engine, + const struct input_event *syn); + struct touch_frame frame; + void *priv; +}; + +int touch_dev_open(struct touch_dev *dev, int fd); +int touch_dev_idle(struct touch_dev *dev, int fd, int ms); +int touch_dev_pull(struct touch_dev *dev, int fd); +void touch_dev_close(struct touch_dev *dev, int fd); + +void touch_engine_init(struct touch_engine *engine, + void (*event)(struct touch_engine *engine, + const struct input_event *ev), + void (*sync)(struct touch_engine *engine, + const struct input_event *ev), + void *priv); +void touch_engine_attach(struct touch_engine *engine, struct touch_dev *dev); +void touch_engine_detach(struct touch_engine *engine, struct touch_dev *dev); + +#endif -- cgit v1.2.3