summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/utouch/frame.h11
-rw-r--r--src/frame.c20
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);
250int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot); 250int 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 */
261int 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
208int 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
208static void transform_slot(struct utouch_contact *slot, 228static void transform_slot(struct utouch_contact *slot,
209 const struct utouch_surface *s) 229 const struct utouch_surface *s)
210{ 230{