From e15534ff5c7464b39ed1402a2827232fa06934bd Mon Sep 17 00:00:00 2001 From: Junghoon Date: Mon, 2 Nov 2015 17:00:44 +0900 Subject: [PATCH] pepper: change touch APIs - change pepper_touch_point_get_focus to pepper_touch_get_focus - change pepper_touch_point_set_focus to pepper_touch_set_focus - add / remove touch point in pepper_touch_set_focus Change-Id: I48d278662798b01189431f38ce3e1f772ec56db1 --- src/lib/pepper/pepper.h | 4 ++-- src/lib/pepper/touch.c | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lib/pepper/pepper.h b/src/lib/pepper/pepper.h index e302264..76620dc 100644 --- a/src/lib/pepper/pepper.h +++ b/src/lib/pepper/pepper.h @@ -1003,10 +1003,10 @@ PEPPER_API void pepper_touch_remove_point(pepper_touch_t *touch, uint32_t id); PEPPER_API void -pepper_touch_point_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus); +pepper_touch_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus); PEPPER_API pepper_view_t * -pepper_touch_point_get_focus(pepper_touch_t *touch, uint32_t id); +pepper_touch_get_focus(pepper_touch_t *touch, uint32_t id); PEPPER_API pepper_bool_t pepper_touch_get_position(pepper_touch_t *touch, uint32_t id, double *x, double *y); diff --git a/src/lib/pepper/touch.c b/src/lib/pepper/touch.c index 059cbf6..b226e25 100644 --- a/src/lib/pepper/touch.c +++ b/src/lib/pepper/touch.c @@ -219,15 +219,26 @@ pepper_touch_remove_point(pepper_touch_t *touch, uint32_t id) } PEPPER_API void -pepper_touch_point_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus) +pepper_touch_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus) { pepper_touch_point_t *point = get_touch_point(touch, id); - PEPPER_CHECK(point, return, "Touch point %d does not exist.\n", id); - touch_point_set_focus(point, focus); + + if (focus) + { + if (!point) + pepper_touch_add_point(touch, id, 0, 0); + + touch_point_set_focus(get_touch_point(touch, id), focus); + } + else + { + if (point) + pepper_touch_remove_point(touch, id); + } } PEPPER_API pepper_view_t * -pepper_touch_point_get_focus(pepper_touch_t *touch, uint32_t id) +pepper_touch_get_focus(pepper_touch_t *touch, uint32_t id) { pepper_touch_point_t *point = get_touch_point(touch, id); PEPPER_CHECK(point, return NULL, "Touch point %d does not exist.\n", id); -- 2.7.4