diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-02-14 13:05:19 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-02-15 12:48:14 +0100 |
| commit | e7d652c5efdb402a14a20cc3dbc7b3f084f5a47e (patch) | |
| tree | eb3fdcb089c675f305da612789c8ca417cd0584c | |
| parent | 93e1a5a3904ef2f14110d8b807bcd7d107b3b2a4 (diff) | |
Add set slot by touch id utility
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | include/utouch/frame.h | 11 | ||||
| -rw-r--r-- | src/frame.c | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/utouch/frame.h b/include/utouch/frame.h index 5b5f4d2..03a44aa 100644 --- a/include/utouch/frame.h +++ b/include/utouch/frame.h | |||
| @@ -250,6 +250,17 @@ struct utouch_contact *utouch_frame_get_current_slot(utouch_frame_handle fh); | |||
| 250 | int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot); | 250 | int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot); |
| 251 | 251 | ||
| 252 | /** | 252 | /** |
| 253 | * utouch_frame_set_current_id - set the current slot by touch id | ||
| 254 | * @fh: the frame engine in use | ||
| 255 | * @id: the touch id | ||
| 256 | * | ||
| 257 | * Sets the slot currently being modified, by touch id. If the id is | ||
| 258 | * not currently in use (does not have an active slot), a new slot is | ||
| 259 | * assigned. Returns zero if successful, negative error otherwise. | ||
| 260 | */ | ||
| 261 | int utouch_frame_set_current_id(utouch_frame_handle fh, int id); | ||
| 262 | |||
| 263 | /** | ||
| 253 | * utouch_frame_sync - synchronize and return new frame | 264 | * utouch_frame_sync - synchronize and return new frame |
| 254 | * @fh: the frame engine in use | 265 | * @fh: the frame engine in use |
| 255 | * @time: the frame synchronization time (ms) | 266 | * @time: the frame synchronization time (ms) |
diff --git a/src/frame.c b/src/frame.c index e722adf..061b170 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -205,6 +205,26 @@ int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot) | |||
| 205 | return 0; | 205 | return 0; |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | int utouch_frame_set_current_id(utouch_frame_handle fh, int id) | ||
| 209 | { | ||
| 210 | struct utouch_contact *t; | ||
| 211 | int i; | ||
| 212 | |||
| 213 | for (i = 0; i < fh->num_slots; i++) { | ||
| 214 | t = fh->next->slots[i]; | ||
| 215 | if (t->id == id) | ||
| 216 | return utouch_frame_set_current_slot(fh, i); | ||
| 217 | } | ||
| 218 | for (i = 0; i < fh->num_slots; i++) { | ||
| 219 | t = fh->next->slots[i]; | ||
| 220 | if (t->id < 0) { | ||
| 221 | t->id = id; | ||
| 222 | return utouch_frame_set_current_slot(fh, i); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | return -ENOMEM; | ||
| 226 | } | ||
| 227 | |||
| 208 | static void transform_slot(struct utouch_contact *slot, | 228 | static void transform_slot(struct utouch_contact *slot, |
| 209 | const struct utouch_surface *s) | 229 | const struct utouch_surface *s) |
| 210 | { | 230 | { |
