From 3b9c20f869a2f55bd9953665c9e7fd713db4ff43 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 20 Jul 2010 12:01:32 +0200 Subject: Merge in fix of dev package. This patch moves header files around, and does not contain any logic changes. Signed-off-by: Henrik Rydberg --- include/gesture-buffer.h | 62 ----------------------------- include/gesture-client.h | 48 ----------------------- include/gesture-dev.h | 47 ---------------------- include/gesture.h | 57 --------------------------- include/grail-touch.h | 100 +++++++++++++++++++++++++++++++++++++++++++++++ include/grail.h | 63 ++++++++++++++++++++++++++++- include/touch-dev.h | 49 ----------------------- include/touch-engine.h | 56 -------------------------- include/touch.h | 57 --------------------------- 9 files changed, 161 insertions(+), 378 deletions(-) delete mode 100644 include/gesture-buffer.h delete mode 100644 include/gesture-client.h delete mode 100644 include/gesture-dev.h delete mode 100644 include/gesture.h create mode 100644 include/grail-touch.h delete mode 100644 include/touch-dev.h delete mode 100644 include/touch-engine.h delete mode 100644 include/touch.h (limited to 'include') diff --git a/include/gesture-buffer.h b/include/gesture-buffer.h deleted file mode 100644 index 49a6dd1..0000000 --- a/include/gesture-buffer.h +++ /dev/null @@ -1,62 +0,0 @@ -/***************************************************************************** - * - * 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_GESTURE_BUFFER_H -#define _GRAIL_GESTURE_BUFFER_H - -#include - -#define DIM_GESTURE_EVENTS 512 - -struct gebuf { - int head; - int tail; - struct gesture_event buffer[DIM_GESTURE_EVENTS]; -}; - -static inline void gebuf_clear(struct gebuf *gebuf) -{ - gebuf->head = gebuf->tail = 0; -} - -static inline int gebuf_empty(const struct gebuf *gebuf) -{ - return gebuf->head == gebuf->tail; -} - -static inline void gebuf_put(struct gebuf *gebuf, - const struct gesture_event *ev) -{ - gebuf->buffer[gebuf->head++] = *ev; - gebuf->head &= DIM_GESTURE_EVENTS - 1; -} - -static inline void gebuf_get(struct gebuf *gebuf, - struct gesture_event *ev) -{ - *ev = gebuf->buffer[gebuf->tail++]; - gebuf->tail &= DIM_GESTURE_EVENTS - 1; -} - -#endif diff --git a/include/gesture-client.h b/include/gesture-client.h deleted file mode 100644 index f507eb4..0000000 --- a/include/gesture-client.h +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * - * 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_GESTURE_CLIENT_H -#define _GRAIL_GESTURE_CLIENT_H - -#include - -struct gesture_client { - void (*gesture)(struct gesture_client *client, - const struct gesture_event *ev); - int priority[DIM_GESTURE_TYPE]; - struct client_impl *impl; - void *priv; -}; - -int client_init(struct gesture_client *client, void *priv); - -void client_flag(struct gesture_client *client, - const struct gesture_flag *flag); -void client_event(struct gesture_client *client, - const struct gesture_event *ev); -void client_sync(struct gesture_client *client); - -void client_destroy(struct gesture_client *client); - -#endif diff --git a/include/gesture-dev.h b/include/gesture-dev.h deleted file mode 100644 index 635fc2f..0000000 --- a/include/gesture-dev.h +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * - * 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_GESTURE_DEV_H -#define _GRAIL_GESTURE_DEV_H - -#include - -struct gesture_dev { - struct gedev_impl *impl; - void *priv; -}; - -int gedev_init(struct gesture_dev *dev, void *priv); -int gedev_attach_client(struct gesture_dev *dev, - struct gesture_client *client); - -void gedev_flag(struct gesture_dev *dev, const struct gesture_flag *flag); -void gedev_event(struct gesture_dev *dev, const struct gesture_event *ev); -void gedev_sync(struct gesture_dev *dev); - -void gedev_detach_client(struct gesture_dev *dev, - struct gesture_client *client); -void gedev_destroy(struct gesture_dev *dev); - -#endif diff --git a/include/gesture.h b/include/gesture.h deleted file mode 100644 index b4f2d5c..0000000 --- a/include/gesture.h +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * - * 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_GESTURE_H -#define _GRAIL_GESTURE_H - -#include - -#define DIM_GESTURE_PROP 8 -typedef int gesture_prop_t; - -enum gesture_type { - GE_MOVE, - GE_VSCROLL, - DIM_GESTURE_TYPE -}; - -enum gesture_state { - GS_CANCEL, - GS_BEGIN, - GS_END -}; - -struct gesture_flag { - enum gesture_type type; - touch_time_t time; - enum gesture_state state; -}; - -struct gesture_event { - enum gesture_type type; - touch_time_t time; - gesture_prop_t prop[DIM_GESTURE_PROP]; -}; - -#endif diff --git a/include/grail-touch.h b/include/grail-touch.h new file mode 100644 index 0000000..d6c9bf5 --- /dev/null +++ b/include/grail-touch.h @@ -0,0 +1,100 @@ +/***************************************************************************** + * + * 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 + +#define DIM_TOUCHES 32 + +typedef int touch_prop_t; +typedef unsigned touch_prop_mask_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 +}; + +struct touch { + int active; + int slot; + int next; + touch_prop_t prop[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 touch_prop_mask_t *mask, const touch_prop_t *prop); + void (*modify)(struct touch_dev *dev, int slot, + const touch_prop_mask_t *mask, const touch_prop_t *prop); + void (*destroy)(struct touch_dev *dev, int slot); + void (*sync)(struct touch_dev *dev, touch_time_t time); + struct touch_dev_impl *impl; + void *priv; +}; + +struct touch_frame { + int ntouch; + int slot; + struct touch touch[DIM_TOUCHES]; +}; + +struct touch_engine { + void (*sync)(struct touch_engine *engine, touch_time_t time); + struct touch_frame frame; + void *priv; +}; + +static inline int has_prop(const touch_prop_mask_t *mask, int code) +{ + return (mask[code >> 5] >> (code & 31)) & 1; +} + +static inline int next_slot(const struct touch_frame *frame, int slot) +{ + return frame->touch[slot].next; +} + +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 (*sync)(struct touch_engine *engine, + touch_time_t time), + void *priv); +void touch_engine_attach(struct touch_engine *engine, struct touch_dev *dev); + +#endif diff --git a/include/grail.h b/include/grail.h index b2f4a0d..087cf0c 100644 --- a/include/grail.h +++ b/include/grail.h @@ -25,7 +25,66 @@ #ifndef _GRAIL_H #define _GRAIL_H -#include -#include +#include + +#define DIM_GESTURE_PROP 8 +typedef int gesture_prop_t; + +enum gesture_type { + GE_MOVE, + GE_VSCROLL, + DIM_GESTURE_TYPE +}; + +enum gesture_state { + GS_CANCEL, + GS_BEGIN, + GS_END +}; + +struct gesture_flag { + enum gesture_type type; + touch_time_t time; + enum gesture_state state; +}; + +struct gesture_event { + enum gesture_type type; + touch_time_t time; + gesture_prop_t prop[DIM_GESTURE_PROP]; +}; + +struct gesture_dev { + struct gedev_impl *impl; + void *priv; +}; + +struct gesture_client { + void (*gesture)(struct gesture_client *client, + const struct gesture_event *ev); + int priority[DIM_GESTURE_TYPE]; + struct client_impl *impl; + void *priv; +}; + +int client_init(struct gesture_client *client, void *priv); +void client_flag(struct gesture_client *client, + const struct gesture_flag *flag); +void client_event(struct gesture_client *client, + const struct gesture_event *ev); +void client_sync(struct gesture_client *client); +void client_destroy(struct gesture_client *client); + +int gedev_init(struct gesture_dev *dev, void *priv); +int gedev_attach_client(struct gesture_dev *dev, + struct gesture_client *client); + +void gedev_flag(struct gesture_dev *dev, const struct gesture_flag *flag); +void gedev_event(struct gesture_dev *dev, const struct gesture_event *ev); +void gedev_sync(struct gesture_dev *dev); + +void gedev_detach_client(struct gesture_dev *dev, + struct gesture_client *client); +void gedev_destroy(struct gesture_dev *dev); #endif diff --git a/include/touch-dev.h b/include/touch-dev.h deleted file mode 100644 index 4ecd61b..0000000 --- a/include/touch-dev.h +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************** - * - * 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_DEV_H -#define _GRAIL_TOUCH_DEV_H - -#include - -typedef __u64 touch_time_t; - -struct touch_dev { - void (*event)(struct touch_dev *dev, const struct input_event *ev); - void (*create)(struct touch_dev *dev, int slot, - const touch_prop_mask_t *mask, const touch_prop_t *prop); - void (*modify)(struct touch_dev *dev, int slot, - const touch_prop_mask_t *mask, const touch_prop_t *prop); - void (*destroy)(struct touch_dev *dev, int slot); - void (*sync)(struct touch_dev *dev, touch_time_t time); - struct touch_dev_impl *impl; - 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); - -#endif diff --git a/include/touch-engine.h b/include/touch-engine.h deleted file mode 100644 index 389c2a7..0000000 --- a/include/touch-engine.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * - * 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_ENGINE_H -#define _GRAIL_TOUCH_ENGINE_H - -#include - -#define DIM_TOUCHES 32 - -struct touch_frame { - int ntouch; - int slot; - struct touch touch[DIM_TOUCHES]; -}; - -static inline int next_slot(const struct touch_frame *frame, int slot) -{ - return frame->touch[slot].next; -} - -struct touch_engine { - void (*sync)(struct touch_engine *engine, touch_time_t time); - struct touch_frame frame; - void *priv; -}; - -void touch_engine_init(struct touch_engine *engine, - void (*sync)(struct touch_engine *engine, - touch_time_t time), - 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 diff --git a/include/touch.h b/include/touch.h deleted file mode 100644 index 56c0044..0000000 --- a/include/touch.h +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * - * 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 - -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 -}; - -typedef int touch_prop_t; -typedef unsigned touch_prop_mask_t; - -struct touch { - int active; - int slot; - int next; - touch_prop_t prop[DIM_TOUCH_PROP]; -}; - -static inline int has_prop(const touch_prop_mask_t *mask, int code) -{ - return (mask[code >> 5] >> (code & 31)) & 1; -} - -#endif -- cgit v1.2.3