pepper: change touch APIs
authorJunghoon <jh13.son@samsung.com>
Mon, 2 Nov 2015 08:00:44 +0000 (17:00 +0900)
committerJunghoon <jh13.son@samsung.com>
Mon, 2 Nov 2015 08:00:44 +0000 (17:00 +0900)
    - 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
src/lib/pepper/touch.c

index e302264..76620dc 100644 (file)
@@ -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);
index 059cbf6..b226e25 100644 (file)
@@ -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);