From a704984e03d28b4be40e12c43be1b163bc9e09e2 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 19 Aug 2010 20:03:15 +0200 Subject: Simplify touch machinery To be able to model touch information uniformly across all supported devices, the semantics of the touch attributes has to be treated explicitly. Drop the generic touch property array and replace it by an actual structure. In addition, the touch-engine abstraction turned out to not be needed, so drop it as well. Signed-off-by: Henrik Rydberg --- include/grail-touch.h | 65 +++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) (limited to 'include') diff --git a/include/grail-touch.h b/include/grail-touch.h index 9d96cc3..acfc779 100644 --- a/include/grail-touch.h +++ b/include/grail-touch.h @@ -29,27 +29,20 @@ #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]; + int id; + int tool_type; + int x, y; + int touch_major; + int touch_minor; + int width_major; + int width_minor; + int orientation; + int pressure; }; struct touch_frame { @@ -61,45 +54,31 @@ struct touch_frame { 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_caps { + float min_x, max_x; + float min_y, max_y; + float min_orient, max_orient; + float min_press, max_press; }; 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 mtdev mtdev; struct touch_frame frame; - void *priv; + struct touch_caps caps; + int slot; + int state; }; +void touch_caps_init(struct touch_dev *dev); +float touch_angle(const struct touch_dev *dev, int orientation); +float touch_pressure(const struct touch_dev *dev, int pressure); + 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