summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-18 14:54:54 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-26 10:18:01 +0900
commit2857d7c2cfdb38d71f6870eb551d239a80af5331 (patch)
tree451e29558e895e33879cea8da88f50540b791b22
parent328151f999c8be4351e8f2664fa802e0512f1fac (diff)
evas events: Switch multi up/down to the new event type
-rw-r--r--src/lib/evas/canvas/evas_events.c412
1 files changed, 205 insertions, 207 deletions
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 1135c81a05..8243607700 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -20,11 +20,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, Evas_Public_Data *e, int x, int
20 Efl_Event_Pointer *parent_pe); 20 Efl_Event_Pointer *parent_pe);
21 21
22static void 22static void
23_canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd, int d, int x, int y, 23_canvas_event_feed_multi_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data *ev);
24 double rad, double radx, double rady, double pres, double ang,
25 double fx, double fy, Evas_Button_Flags flags,
26 unsigned int timestamp, const void *data,
27 Efl_Event_Pointer *parent_pe);
28 24
29/* FIXME: remove this */ 25/* FIXME: remove this */
30static void 26static void
@@ -872,27 +868,30 @@ _evas_event_source_wheel_events(Evas_Object *eo_obj, Evas *eo_e,
872} 868}
873 869
874static void 870static void
875_evas_event_source_multi_down_events(Evas_Object *eo_obj, Evas *eo_e, 871_evas_event_source_multi_down_events(Evas_Object_Protected_Data *obj, Evas_Public_Data *e,
876 Evas_Event_Multi_Down *ev, int event_id, 872 Efl_Event_Pointer *parent_ev, int event_id)
877 Efl_Event_Pointer *parent_pe)
878{ 873{
879 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 874 Evas_Object *eo_src = _evas_object_image_source_get(obj->object);
880 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
881 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS); 875 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS);
882 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 876 Evas_Object_Protected_Data *child;
883 Evas_Coord_Precision_Point canvas = ev->canvas; 877 Evas_Object *eo_child;
884 Efl_Event_Pointer *pe = NULL; 878 Eina_List *copy, *l;
879 Efl_Event_Pointer_Data *ev;
880 Efl_Event_Pointer *evt;
881 Eina_Vector2 point;
882 int addgrab = 0;
885 883
886 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return; 884 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return;
887 885
888 _transform_to_src_space(obj, src, &ev->canvas.x, &ev->canvas.y); 886 evt = efl_event_dup(parent_ev);
889 //FIXME: transform precision 887 ev = efl_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
888 if (!ev) return;
890 889
891 Eina_List *l; 890 _transform_to_src_space_f(obj, src, &ev->cur);
892 Evas_Object *eo_child; 891 point = ev->cur;
893 Evas_Object_Protected_Data *child = NULL; 892 ev->source = obj->object;
893 ev->action = EFL_POINTER_ACTION_DOWN;
894 894
895 int addgrab = 0;
896 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1; 895 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1;
897 896
898 EINA_LIST_FOREACH(src->proxy->src_event_in, l, eo_child) 897 EINA_LIST_FOREACH(src->proxy->src_event_in, l, eo_child)
@@ -905,53 +904,48 @@ _evas_event_source_multi_down_events(Evas_Object *eo_obj, Evas *eo_e,
905 } 904 }
906 } 905 }
907 906
908 Evas_Coord_Precision_Point point = ev->canvas; 907 copy = evas_event_list_copy(src->proxy->src_event_in);
909
910 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in);
911 EINA_LIST_FOREACH(copy, l, eo_child) 908 EINA_LIST_FOREACH(copy, l, eo_child)
912 { 909 {
913 ev->canvas = point;
914 _evas_event_havemap_adjust(eo_child, child,
915 &ev->canvas.x,
916 &ev->canvas.y,
917 child->mouse_grabbed);
918 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS); 910 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
919 EV_CALL(eo_child, child, EVAS_CALLBACK_MULTI_DOWN, ev, event_id, pe, parent_pe); 911 ev->cur = point;
912 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
913 evas_object_event_callback_call(obj->object, obj, EVAS_CALLBACK_MULTI_DOWN, NULL,
914 event_id, EFL_EVENT_POINTER_DOWN, ev->eo);
920 if (e->delete_me) break; 915 if (e->delete_me) break;
921 } 916 }
922 eina_list_free(copy); 917 eina_list_free(copy);
923 918
924 ev->canvas = canvas; 919 efl_del(evt);
925 EV_DEL(pe);
926} 920}
927 921
928static void 922static void
929_evas_event_source_multi_up_events(Evas_Object *eo_obj, Evas *eo_e, 923_evas_event_source_multi_up_events(Evas_Object_Protected_Data *obj, Evas_Public_Data *e,
930 Evas_Event_Multi_Up *ev, int event_id, 924 Efl_Event_Pointer *parent_ev, int event_id)
931 Efl_Event_Pointer *parent_pe)
932{ 925{
933 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 926 Evas_Object *eo_src = _evas_object_image_source_get(obj->object);
934 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
935 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS); 927 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS);
936 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 928 Evas_Object_Protected_Data *child;
937 Evas_Coord_Precision_Point canvas = ev->canvas; 929 Evas_Object *eo_child;
938 Efl_Event_Pointer *pe = NULL; 930 Eina_List *copy, *l;
931 Efl_Event_Pointer_Data *ev;
932 Efl_Event_Pointer *evt;
933 Eina_Vector2 point;
939 934
940 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return; 935 if (obj->delete_me || src->delete_me || obj->layer->evas->is_frozen) return;
941 936
942 _transform_to_src_space(obj, src, &ev->canvas.x, &ev->canvas.y); 937 evt = efl_event_dup(parent_ev);
943 //FIXME: transform precision 938 ev = efl_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
944 939 if (!ev) return;
945 Evas_Coord_Precision_Point point = ev->canvas;
946 940
947 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in); 941 _transform_to_src_space_f(obj, src, &ev->cur);
942 point = ev->cur;
943 ev->source = obj->object;
944 ev->action = EFL_POINTER_ACTION_UP;
948 945
949 Eina_List *l; 946 copy = evas_event_list_copy(src->proxy->src_event_in);
950 Evas_Object *eo_child;
951 Evas_Object_Protected_Data *child = NULL;
952 EINA_LIST_FOREACH(copy, l, eo_child) 947 EINA_LIST_FOREACH(copy, l, eo_child)
953 { 948 {
954 ev->canvas = point;
955 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS); 949 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
956 if (((child->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) || 950 if (((child->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) ||
957 (child->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) || 951 (child->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) ||
@@ -960,17 +954,15 @@ _evas_event_source_multi_up_events(Evas_Object *eo_obj, Evas *eo_e,
960 child->mouse_grabbed--; 954 child->mouse_grabbed--;
961 e->pointer.mouse_grabbed--; 955 e->pointer.mouse_grabbed--;
962 } 956 }
963 _evas_event_havemap_adjust(eo_child, child, 957 ev->cur = point;
964 &ev->canvas.x, 958 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
965 &ev->canvas.y, 959 evas_object_event_callback_call(obj->object, obj, EVAS_CALLBACK_MULTI_UP, NULL,
966 child->mouse_grabbed); 960 event_id, EFL_EVENT_POINTER_UP, ev->eo);
967 EV_CALL(eo_child, child, EVAS_CALLBACK_MULTI_UP, ev, event_id, pe, parent_pe);
968 if (e->delete_me || e->is_frozen) break; 961 if (e->delete_me || e->is_frozen) break;
969 } 962 }
970 eina_list_free(copy); 963 eina_list_free(copy);
971 964
972 ev->canvas = canvas; 965 efl_del(evt);
973 EV_DEL(pe);
974} 966}
975 967
976static void 968static void
@@ -1684,17 +1676,20 @@ evas_event_feed_mouse_up(Eo *eo_e, int b, Evas_Button_Flags flags, unsigned int
1684} 1676}
1685 1677
1686static void 1678static void
1687_canvas_event_feed_mouse_cancel_internal(Eo *eo_e, unsigned int timestamp, const void *data, 1679_canvas_event_feed_mouse_cancel_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data *ev)
1688 Efl_Event_Pointer *parent_pe)
1689{ 1680{
1690 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
1691 Evas_Coord_Touch_Point *point; 1681 Evas_Coord_Touch_Point *point;
1682 Efl_Event_Pointer_Data save;
1692 Eina_List *l, *ll; 1683 Eina_List *l, *ll;
1693 Evas_Event_Flags flags; 1684 Evas_Event_Flags flags;
1685 Evas *eo_e;
1694 int i; 1686 int i;
1695 1687
1688 if (!e || !ev) return;
1696 if (e->is_frozen) return; 1689 if (e->is_frozen) return;
1697 1690
1691 save = *ev;
1692 eo_e = e->evas;
1698 _evas_walk(e); 1693 _evas_walk(e);
1699 1694
1700 flags = evas_event_default_flags_get(eo_e); 1695 flags = evas_event_default_flags_get(eo_e);
@@ -1703,23 +1698,45 @@ _canvas_event_feed_mouse_cancel_internal(Eo *eo_e, unsigned int timestamp, const
1703 for (i = 0; i < 32; i++) 1698 for (i = 0; i < 32; i++)
1704 { 1699 {
1705 if ((e->pointer.button & (1u << i))) 1700 if ((e->pointer.button & (1u << i)))
1706 _canvas_event_feed_mouse_updown_legacy(eo_e, i + 1, 0, timestamp, data, 0); 1701 _canvas_event_feed_mouse_updown_legacy(eo_e, i + 1, 0, ev->timestamp, ev->data, 0);
1707 } 1702 }
1703
1704 ev->event_flags = flags;
1708 EINA_LIST_FOREACH_SAFE(e->touch_points, l, ll, point) 1705 EINA_LIST_FOREACH_SAFE(e->touch_points, l, ll, point)
1709 { 1706 {
1710 if ((point->state == EVAS_TOUCH_POINT_DOWN) || 1707 if ((point->state == EVAS_TOUCH_POINT_DOWN) ||
1711 (point->state == EVAS_TOUCH_POINT_MOVE)) 1708 (point->state == EVAS_TOUCH_POINT_MOVE))
1712 _canvas_event_feed_multi_up_internal(eo_e, e, point->id, point->x, point->y, 1709 {
1713 0, 0, 0, 0, 0, 0, 0, 0, timestamp, data, parent_pe); 1710 ev->button = point->id;
1711 ev->cur.x = point->x;
1712 ev->cur.y = point->y;
1713 _canvas_event_feed_multi_up_internal(e, ev);
1714 }
1714 } 1715 }
1715 evas_event_default_flags_set(eo_e, flags); 1716 evas_event_default_flags_set(eo_e, flags);
1716 _evas_unwalk(e); 1717 _evas_unwalk(e);
1718
1719 *ev = save;
1717} 1720}
1718 1721
1719EAPI void 1722EAPI void
1720evas_event_feed_mouse_cancel(Eo *eo_e, unsigned int timestamp, const void *data) 1723evas_event_feed_mouse_cancel(Eo *eo_e, unsigned int timestamp, const void *data)
1721{ 1724{
1722 _canvas_event_feed_mouse_cancel_internal(eo_e, timestamp, data, NULL); 1725 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
1726 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
1727 Efl_Event_Pointer_Data *ev = NULL;
1728 Efl_Event_Pointer *evt;
1729
1730 evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, eo_e, (void **) &ev);
1731 if (!ev) return;
1732
1733 ev->timestamp = timestamp;
1734 ev->data = (void *) data;
1735 ev->device = _evas_device_top_get(e->evas);
1736
1737 _canvas_event_feed_mouse_cancel_internal(e, ev);
1738
1739 efl_del(evt);
1723} 1740}
1724 1741
1725static void 1742static void
@@ -2351,7 +2368,6 @@ static void
2351_canvas_event_feed_mouse_out_internal(Evas *eo_e, Efl_Event_Pointer_Data *ev) 2368_canvas_event_feed_mouse_out_internal(Evas *eo_e, Efl_Event_Pointer_Data *ev)
2352{ 2369{
2353 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2370 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2354 Efl_Event_Pointer *pe = NULL;
2355 Eina_List *l, *copy; 2371 Eina_List *l, *copy;
2356 Evas_Object *eo_obj; 2372 Evas_Object *eo_obj;
2357 int event_id; 2373 int event_id;
@@ -2391,7 +2407,7 @@ _canvas_event_feed_mouse_out_internal(Evas *eo_e, Efl_Event_Pointer_Data *ev)
2391 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_OUT, NULL, 2407 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_OUT, NULL,
2392 event_id, EFL_EVENT_POINTER_OUT, ev->eo); 2408 event_id, EFL_EVENT_POINTER_OUT, ev->eo);
2393 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2409 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2394 _evas_event_source_mouse_out_events(eo_obj, eo_e, pe, event_id); 2410 _evas_event_source_mouse_out_events(eo_obj, eo_e, ev->eo, event_id);
2395 if (e->delete_me || e->is_frozen) break; 2411 if (e->delete_me || e->is_frozen) break;
2396 } 2412 }
2397 obj->mouse_grabbed = 0; 2413 obj->mouse_grabbed = 0;
@@ -2442,54 +2458,37 @@ evas_event_feed_mouse_out(Eo *eo_e, unsigned int timestamp, const void *data)
2442} 2458}
2443 2459
2444static void 2460static void
2445_canvas_event_feed_multi_down_internal(Evas *eo_e, void *_pd, 2461_canvas_event_feed_multi_down_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data *ev)
2446 int d, int x, int y,
2447 double rad, double radx, double rady,
2448 double pres, double ang,
2449 double fx, double fy,
2450 Evas_Button_Flags flags, unsigned int timestamp,
2451 const void *data, Efl_Event_Pointer *parent_pe)
2452{ 2462{
2453 Evas_Public_Data *e = _pd;
2454 Eina_List *l, *copy; 2463 Eina_List *l, *copy;
2455 Evas_Event_Multi_Down ev;
2456 Efl_Event_Pointer *pe = NULL;
2457 Evas_Object *eo_obj; 2464 Evas_Object *eo_obj;
2465 Eina_Vector2 point;
2466 Evas *eo_e;
2467 int event_id;
2458 int addgrab = 0; 2468 int addgrab = 0;
2459 int event_id = 0;
2460 2469
2461 INF("ButtonEvent:multi down time=%u x=%d y=%d button=%d downs=%d", timestamp, x, y, d, e->pointer.downs); 2470 if (!e || !ev) return;
2471
2472 eo_e = e->evas;
2473 DBG("ButtonEvent:multi down time=%u x=%.1f y=%.1f button=%d downs=%d",
2474 ev->timestamp, ev->cur.x, ev->cur.y, ev->finger, e->pointer.downs);
2462 e->pointer.downs++; 2475 e->pointer.downs++;
2463 if (e->is_frozen) return; 2476 if (e->is_frozen) return;
2464 e->last_timestamp = timestamp; 2477 e->last_timestamp = ev->timestamp;
2465 2478
2466 _evas_object_event_new(); 2479 _evas_object_event_new();
2467
2468 event_id = _evas_event_counter; 2480 event_id = _evas_event_counter;
2469 ev.device = d; 2481
2470 ev.output.x = x; 2482 point = ev->cur;
2471 ev.output.y = y; 2483 ev->action = EFL_POINTER_ACTION_DOWN;
2472 ev.canvas.x = x; 2484 ev->modifiers = &(e->modifiers);
2473 ev.canvas.y = y; 2485 ev->locks = &(e->locks);
2474 ev.radius = rad; 2486 ev->event_flags = e->default_event_flags;
2475 ev.radius_x = radx; 2487 if (ev->device) efl_ref(ev->device);
2476 ev.radius_y = rady;
2477 ev.pressure = pres;
2478 ev.angle = ang;
2479 ev.canvas.xsub = fx;
2480 ev.canvas.ysub = fy;
2481 ev.data = (void *)data;
2482 ev.modifiers = &(e->modifiers);
2483 ev.locks = &(e->locks);
2484 ev.flags = flags;
2485 ev.timestamp = timestamp;
2486 ev.event_flags = e->default_event_flags;
2487 ev.dev = _evas_device_top_get(eo_e);
2488 if (ev.dev) efl_ref(ev.dev);
2489 2488
2490 _evas_walk(e); 2489 _evas_walk(e);
2491 /* append new touch point to the touch point list */ 2490 /* append new touch point to the touch point list */
2492 _evas_touch_point_append(eo_e, d, x, y); 2491 _evas_touch_point_append(eo_e, ev->finger, ev->cur.x, ev->cur.y);
2493 if (e->pointer.mouse_grabbed == 0) 2492 if (e->pointer.mouse_grabbed == 0)
2494 { 2493 {
2495 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1; 2494 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1;
@@ -2507,114 +2506,62 @@ _canvas_event_feed_multi_down_internal(Evas *eo_e, void *_pd,
2507 EINA_LIST_FOREACH(copy, l, eo_obj) 2506 EINA_LIST_FOREACH(copy, l, eo_obj)
2508 { 2507 {
2509 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 2508 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2510 ev.canvas.x = x; 2509 ev->cur = point;
2511 ev.canvas.y = y; 2510 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj->mouse_grabbed);
2512 ev.canvas.xsub = fx; 2511 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MULTI_DOWN, NULL,
2513 ev.canvas.ysub = fy; 2512 event_id, EFL_EVENT_POINTER_DOWN, ev->eo);
2514 _evas_event_havemap_adjust(eo_obj, obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed);
2515 if (x != ev.canvas.x)
2516 ev.canvas.xsub = ev.canvas.x; // fixme - lost precision
2517 if (y != ev.canvas.y)
2518 ev.canvas.ysub = ev.canvas.y; // fixme - lost precision
2519 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MULTI_DOWN, &ev, event_id, pe, parent_pe);
2520 if ((obj->proxy->is_proxy) || (obj->proxy->src_events)) 2513 if ((obj->proxy->is_proxy) || (obj->proxy->src_events))
2521 _evas_event_source_multi_down_events(eo_obj, eo_e, &ev, event_id, pe); 2514 _evas_event_source_multi_down_events(obj, e, ev->eo, event_id);
2522 if (e->delete_me || e->is_frozen) break; 2515 if (e->delete_me || e->is_frozen) break;
2523 } 2516 }
2524 eina_list_free(copy); 2517 eina_list_free(copy);
2525 2518
2526 _evas_post_event_callback_call(eo_e, e); 2519 _evas_post_event_callback_call(eo_e, e);
2527 /* update touch point's state to EVAS_TOUCH_POINT_STILL */ 2520 /* update touch point's state to EVAS_TOUCH_POINT_STILL */
2528 _evas_touch_point_update(eo_e, d, x, y, EVAS_TOUCH_POINT_STILL); 2521 _evas_touch_point_update(eo_e, ev->finger, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_STILL);
2529 if (ev.dev) efl_unref(ev.dev);
2530 _evas_unwalk(e); 2522 _evas_unwalk(e);
2531 EV_DEL(pe);
2532}
2533 2523
2534EAPI void 2524 if (ev->device) efl_unref(ev->device);
2535evas_event_input_multi_down(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2536{
2537 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2538 _canvas_event_feed_multi_down_internal(eo_e, e, d,
2539 x - e->framespace.x,
2540 y - e->framespace.y,
2541 rad, radx, rady, pres, ang,
2542 fx, fy, flags, timestamp, data, NULL);
2543}
2544
2545EAPI void
2546evas_event_feed_multi_down(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2547{
2548 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2549 _canvas_event_feed_multi_down_internal(eo_e, e,
2550 d, x, y, rad, radx, rady, pres, ang,
2551 fx, fy, flags, timestamp, data, NULL);
2552} 2525}
2553 2526
2554static void 2527static void
2555_canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd, 2528_canvas_event_feed_multi_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data *ev)
2556 int d, int x, int y,
2557 double rad, double radx, double rady,
2558 double pres, double ang,
2559 double fx, double fy,
2560 Evas_Button_Flags flags,
2561 unsigned int timestamp,
2562 const void *data,
2563 Efl_Event_Pointer *parent_pe)
2564{ 2529{
2565 Efl_Event_Pointer *pe = NULL;
2566 Evas_Public_Data *e = _pd;
2567 Eina_List *l, *copy; 2530 Eina_List *l, *copy;
2568 Evas_Event_Multi_Up ev;
2569 Evas_Object *eo_obj; 2531 Evas_Object *eo_obj;
2570 int event_id = 0; 2532 Eina_Vector2 point;
2533 Evas *eo_e;
2534 int event_id;
2571 2535
2572 INF("ButtonEvent:multi up time=%u x=%d y=%d device=%d downs=%d", timestamp, x, y, d, e->pointer.downs); 2536 if (!e || !ev) return;
2537
2538 eo_e = e->evas;
2539 DBG("ButtonEvent:multi up time=%u x=%.1f y=%.1f device=%d downs=%d",
2540 ev->timestamp, ev->cur.x, ev->cur.y, ev->finger, e->pointer.downs);
2573 if (e->pointer.downs <= 0) return; 2541 if (e->pointer.downs <= 0) return;
2574 e->pointer.downs--; 2542 e->pointer.downs--;
2575 if (e->is_frozen) return; 2543 if (e->is_frozen) return;
2576 e->last_timestamp = timestamp; 2544 e->last_timestamp = ev->timestamp;
2577 2545
2578 _evas_object_event_new(); 2546 _evas_object_event_new();
2579
2580 event_id = _evas_event_counter; 2547 event_id = _evas_event_counter;
2581 ev.device = d; 2548
2582 ev.output.x = x; 2549 point = ev->cur;
2583 ev.output.y = y; 2550 ev->action = EFL_POINTER_ACTION_UP;
2584 ev.canvas.x = x; 2551 ev->modifiers = &(e->modifiers);
2585 ev.canvas.y = y; 2552 ev->locks = &(e->locks);
2586 ev.radius = rad; 2553 ev->event_flags = e->default_event_flags;
2587 ev.radius_x = radx; 2554 if (ev->device) efl_ref(ev->device);
2588 ev.radius_y = rady;
2589 ev.pressure = pres;
2590 ev.angle = ang;
2591 ev.canvas.xsub = fx;
2592 ev.canvas.ysub = fy;
2593 ev.data = (void *)data;
2594 ev.modifiers = &(e->modifiers);
2595 ev.locks = &(e->locks);
2596 ev.flags = flags;
2597 ev.timestamp = timestamp;
2598 ev.event_flags = e->default_event_flags;
2599 ev.dev = _evas_device_top_get(eo_e);
2600 if (ev.dev) efl_ref(ev.dev);
2601 2555
2602 _evas_walk(e); 2556 _evas_walk(e);
2603 /* update released touch point */ 2557 /* update released touch point */
2604 _evas_touch_point_update(eo_e, d, x, y, EVAS_TOUCH_POINT_UP); 2558 _evas_touch_point_update(eo_e, ev->finger, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_UP);
2605 copy = evas_event_list_copy(e->pointer.object.in); 2559 copy = evas_event_list_copy(e->pointer.object.in);
2606 EINA_LIST_FOREACH(copy, l, eo_obj) 2560 EINA_LIST_FOREACH(copy, l, eo_obj)
2607 { 2561 {
2608 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 2562 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2609 ev.canvas.x = x; 2563 ev->cur = point;
2610 ev.canvas.y = y; 2564 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj->mouse_grabbed);
2611 ev.canvas.xsub = fx;
2612 ev.canvas.ysub = fy;
2613 _evas_event_havemap_adjust(eo_obj, obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed);
2614 if (x != ev.canvas.x)
2615 ev.canvas.xsub = ev.canvas.x; // fixme - lost precision
2616 if (y != ev.canvas.y)
2617 ev.canvas.ysub = ev.canvas.y; // fixme - lost precision
2618 if (((obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) || 2565 if (((obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) ||
2619 (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) && 2566 (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) &&
2620 (obj->mouse_grabbed > 0)) 2567 (obj->mouse_grabbed > 0))
@@ -2622,39 +2569,102 @@ _canvas_event_feed_multi_up_internal(Evas *eo_e, void *_pd,
2622 obj->mouse_grabbed--; 2569 obj->mouse_grabbed--;
2623 e->pointer.mouse_grabbed--; 2570 e->pointer.mouse_grabbed--;
2624 } 2571 }
2625 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MULTI_UP, &ev, event_id, pe, parent_pe); 2572 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MULTI_UP, NULL,
2573 event_id, EFL_EVENT_POINTER_UP, ev->eo);
2626 if ((obj->proxy->is_proxy) || (obj->proxy->src_events)) 2574 if ((obj->proxy->is_proxy) || (obj->proxy->src_events))
2627 _evas_event_source_multi_up_events(eo_obj, eo_e, &ev, event_id, pe); 2575 _evas_event_source_multi_up_events(obj, e, ev->eo, event_id);
2628 if (e->delete_me || e->is_frozen) break; 2576 if (e->delete_me || e->is_frozen) break;
2629 } 2577 }
2630 eina_list_free(copy); 2578 eina_list_free(copy);
2631 if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, parent_pe)) 2579 if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, ev->eo))
2632 _evas_post_event_callback_call(eo_e, e); 2580 _evas_post_event_callback_call(eo_e, e);
2633 /* remove released touch point from the touch point list */ 2581 /* remove released touch point from the touch point list */
2634 _evas_touch_point_remove(eo_e, d); 2582 _evas_touch_point_remove(eo_e, ev->finger);
2635 if (ev.dev) efl_unref(ev.dev);
2636 _evas_unwalk(e); 2583 _evas_unwalk(e);
2637 EV_DEL(pe); 2584
2585 if (ev->device) efl_unref(ev->device);
2586}
2587
2588static inline void
2589_canvas_event_feed_multi_updown_internal(Evas *eo_e, Evas_Public_Data *e,
2590 int d, int x, int y,
2591 double rad, double radx, double rady,
2592 double pres, double ang,
2593 double fx, double fy,
2594 Evas_Button_Flags flags,
2595 unsigned int timestamp,
2596 const void *data, Eina_Bool down)
2597{
2598 Efl_Event_Pointer_Data *ev = NULL;
2599 Efl_Event_Pointer *evt;
2600
2601 evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, eo_e, (void **) &ev);
2602 if (!e || !ev) return;
2603
2604 if (!fx) fx = x;
2605 if (!fy) fy = y;
2606
2607 ev->finger = d;
2608 ev->cur.x = fx;
2609 ev->cur.y = fy;
2610 ev->pressure = pres;
2611 ev->angle = ang;
2612 ev->radius = rad;
2613 ev->radius_x = radx;
2614 ev->radius_y = rady;
2615 ev->button_flags = flags;
2616 ev->timestamp = timestamp;
2617 ev->data = (void *) data;
2618 ev->device = _evas_device_top_get(eo_e);
2619
2620 if (down)
2621 {
2622 ev->action = EFL_POINTER_ACTION_DOWN;
2623 _canvas_event_feed_multi_down_internal(e, ev);
2624 }
2625 else
2626 {
2627 ev->action = EFL_POINTER_ACTION_UP;
2628 _canvas_event_feed_multi_up_internal(e, ev);
2629 }
2630
2631 efl_del(evt);
2632}
2633
2634EAPI void
2635evas_event_input_multi_down(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2636{
2637 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2638 _canvas_event_feed_multi_updown_internal(eo_e, e, d,
2639 x - e->framespace.x, y - e->framespace.y,
2640 rad, radx, rady, pres, ang,
2641 fx, fy, flags, timestamp, data, EINA_TRUE);
2642}
2643
2644EAPI void
2645evas_event_feed_multi_down(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2646{
2647 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2648 _canvas_event_feed_multi_updown_internal(eo_e, e, d, x, y, rad, radx, rady, pres, ang,
2649 fx, fy, flags, timestamp, data, EINA_TRUE);
2638} 2650}
2639 2651
2640EAPI void 2652EAPI void
2641evas_event_input_multi_up(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data) 2653evas_event_input_multi_up(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2642{ 2654{
2643 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2655 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2644 _canvas_event_feed_multi_up_internal(eo_e, e, d, 2656 _canvas_event_feed_multi_updown_internal(eo_e, e, d,
2645 x - e->framespace.x, 2657 x - e->framespace.x, y - e->framespace.y,
2646 y - e->framespace.y, 2658 rad, radx, rady, pres, ang,
2647 rad, radx, rady, 2659 fx, fy, flags, timestamp, data, EINA_FALSE);
2648 pres, ang, fx, fy, flags, timestamp,
2649 data, NULL);
2650} 2660}
2651 2661
2652EAPI void 2662EAPI void
2653evas_event_feed_multi_up(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data) 2663evas_event_feed_multi_up(Eo *eo_e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
2654{ 2664{
2655 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2665 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2656 _canvas_event_feed_multi_up_internal(eo_e, e, d, x, y, rad, radx, rady, 2666 _canvas_event_feed_multi_updown_internal(eo_e, e, d, x, y, rad, radx, rady, pres, ang,
2657 pres, ang, fx, fy, flags, timestamp, data, NULL); 2667 fx, fy, flags, timestamp, data, EINA_FALSE);
2658} 2668}
2659 2669
2660static void 2670static void
@@ -3476,30 +3486,18 @@ _evas_canvas_event_pointer_cb(void *data, const Eo_Event *event)
3476 if (ev->finger == 0) 3486 if (ev->finger == 0)
3477 _canvas_event_feed_mouse_down_internal(e, ev); 3487 _canvas_event_feed_mouse_down_internal(e, ev);
3478 else 3488 else
3479 { 3489 _canvas_event_feed_multi_down_internal(e, ev);
3480 _canvas_event_feed_multi_down_internal(eo_e, e, ev->finger, ev->cur.x, ev->cur.y,
3481 ev->radius, ev->radius_x, ev->radius_y,
3482 ev->pressure, ev->angle,
3483 ev->cur.x, ev->cur.y, ev->button_flags,
3484 ev->timestamp, ev->data, ev->eo);
3485 }
3486 break; 3490 break;
3487 3491
3488 case EFL_POINTER_ACTION_UP: 3492 case EFL_POINTER_ACTION_UP:
3489 if (ev->finger == 0) 3493 if (ev->finger == 0)
3490 _canvas_event_feed_mouse_up_internal(e, ev); 3494 _canvas_event_feed_mouse_up_internal(e, ev);
3491 else 3495 else
3492 { 3496 _canvas_event_feed_multi_up_internal(e, ev);
3493 _canvas_event_feed_multi_up_internal(eo_e, e, ev->finger, ev->cur.x, ev->cur.y,
3494 ev->radius, ev->radius_x, ev->radius_y,
3495 ev->pressure, ev->angle,
3496 ev->cur.x, ev->cur.y, ev->button_flags,
3497 ev->timestamp, ev->data, ev->eo);
3498 }
3499 break; 3497 break;
3500 3498
3501 case EFL_POINTER_ACTION_CANCEL: 3499 case EFL_POINTER_ACTION_CANCEL:
3502 _canvas_event_feed_mouse_cancel_internal(eo_e, ev->timestamp, ev->data, ev->eo); 3500 _canvas_event_feed_mouse_cancel_internal(e, ev);
3503 break; 3501 break;
3504 3502
3505 case EFL_POINTER_ACTION_IN: 3503 case EFL_POINTER_ACTION_IN: