diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-08-06 21:11:17 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-06 21:11:17 +0200 |
| commit | 7db9d8d76ff61c4802ac15559dcea6fa54ff567a (patch) | |
| tree | b67e040c0abeb0ab1fca72754a767dc9ab851461 /include/grail.h | |
initial bzr repo at rev 27
Diffstat (limited to 'include/grail.h')
| -rw-r--r-- | include/grail.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/include/grail.h b/include/grail.h new file mode 100644 index 0000000..0fa4473 --- /dev/null +++ b/include/grail.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * grail - Gesture Recognition And Instantiation Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | * Authors: | ||
| 21 | * Henrik Rydberg <rydberg@bitmath.org> | ||
| 22 | * | ||
| 23 | ****************************************************************************/ | ||
| 24 | |||
| 25 | #ifndef _GRAIL_H | ||
| 26 | #define _GRAIL_H | ||
| 27 | |||
| 28 | #include <grail-bits.h> | ||
| 29 | #include <grail-types.h> | ||
| 30 | #include <linux/input.h> | ||
| 31 | |||
| 32 | #define DIM_GRAIL_TYPE 64 | ||
| 33 | #define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3) | ||
| 34 | |||
| 35 | #define DIM_GRAIL_PROP 16 | ||
| 36 | #define DIM_GRAIL_PROP_BYTES ((DIM_GRAIL_PROP + 7) >> 3) | ||
| 37 | |||
| 38 | #define GRAIL_STATUS_BEGIN 0 | ||
| 39 | #define GRAIL_STATUS_UPDATE 1 | ||
| 40 | #define GRAIL_STATUS_END 2 | ||
| 41 | |||
| 42 | typedef float grail_prop_t; | ||
| 43 | typedef __u64 grail_time_t; | ||
| 44 | |||
| 45 | struct grail_coord { | ||
| 46 | float x, y; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct grail_client_id { | ||
| 50 | int client; | ||
| 51 | int root, event, child; | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct grail_client_info { | ||
| 55 | struct grail_client_id id; | ||
| 56 | grail_mask_t mask[DIM_GRAIL_TYPE_BYTES]; | ||
| 57 | }; | ||
| 58 | |||
| 59 | struct grail_event { | ||
| 60 | int type; | ||
| 61 | int id; | ||
| 62 | int status; | ||
| 63 | int ntouch; | ||
| 64 | int nprop; | ||
| 65 | struct grail_coord pos; | ||
| 66 | struct grail_client_id client_id; | ||
| 67 | grail_time_t time; | ||
| 68 | grail_prop_t prop[DIM_GRAIL_PROP]; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct grail { | ||
| 72 | int (*get_clients)(struct grail *ge, | ||
| 73 | struct grail_client_info *client, int max_clients, | ||
| 74 | const struct grail_coord *coords, int num_coords, | ||
| 75 | const grail_mask_t *types, int type_bytes); | ||
| 76 | void (*event)(struct grail *ge, | ||
| 77 | const struct input_event *ev); | ||
| 78 | void (*gesture)(struct grail *ge, | ||
| 79 | const struct grail_event *ev); | ||
| 80 | struct grail_impl *impl; | ||
| 81 | struct gesture_inserter *gin; | ||
| 82 | struct gesture_recognizer *gru; | ||
| 83 | void *priv; | ||
| 84 | }; | ||
| 85 | |||
| 86 | int grail_open(struct grail *ge, int fd); | ||
| 87 | int grail_idle(struct grail *ge, int fd, int ms); | ||
| 88 | int grail_pull(struct grail *ge, int fd); | ||
| 89 | void grail_close(struct grail *ge, int fd); | ||
| 90 | |||
| 91 | void grail_get_units(struct grail_coord *min, struct grail_coord *max, | ||
| 92 | const struct grail *ge); | ||
| 93 | |||
| 94 | #endif | ||
