summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-17 22:00:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-26 10:18:01 +0900
commitedd88292a49a02db660b62b1a72368a761f4f46b (patch)
treedda9ce71567b66fe43f13ff79031d6a81d2ffc86
parent56c682452c17134959cb07bc290d9d7d059026e3 (diff)
evas events: Switch mouse move event to the new event type (1)
This only modifies the proxy source handling code.
-rw-r--r--src/lib/evas/canvas/evas_events.c117
1 files changed, 57 insertions, 60 deletions
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index db4ac4cd41..a281eb3e96 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -585,32 +585,38 @@ _evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e,
585 585
586static void 586static void
587_evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e, 587_evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
588 Evas_Event_Mouse_Move *ev, int event_id, 588 Efl_Event_Pointer *parent_ev, int event_id)
589 Efl_Event_Pointer *parent_pe)
590{ 589{
591 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 590 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
592 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 591 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
593 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS); 592 Evas_Object_Protected_Data *src = efl_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS);
594 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 593 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
595 Evas_Coord_Point canvas = ev->cur.canvas; 594 Evas_Object_Protected_Data *child;
596 Efl_Event_Pointer *pe = NULL; 595 Evas_Object *eo_child;
596 Eina_List *l;
597 Efl_Event_Pointer_Data *ev;
598 Efl_Event_Pointer *evt;
599 Eina_Vector2 curpt, curpt_real, prevpt, prevpt_real;
597 600
598 if (obj->delete_me || src->delete_me || e->is_frozen) return; 601 if (obj->delete_me || src->delete_me || e->is_frozen) return;
599 602
600 _transform_to_src_space(obj, src, &ev->cur.canvas.x, &ev->cur.canvas.y); 603 evt = efl_event_dup(parent_ev);
601 604 ev = efl_data_scope_get(evt, EFL_EVENT_POINTER_CLASS);
602 ev->event_src = eo_obj; 605 if (!ev) return;
603 606
604 //FIXME: transform previous coords also. 607 curpt_real = ev->cur;
605 Eina_List *l; 608 prevpt_real = ev->prev;
606 Evas_Object *eo_child; 609 _transform_to_src_space_f(obj, src, &ev->cur);
607 Evas_Object_Protected_Data *child; 610 _transform_to_src_space_f(obj, src, &ev->prev);
608 Evas_Coord_Point point = ev->cur.canvas; 611 curpt = ev->cur;
612 prevpt = ev->prev;
613 ev->source = eo_obj;
609 614
610 if (e->pointer.mouse_grabbed) 615 if (e->pointer.mouse_grabbed)
611 { 616 {
612 Eina_List *outs = NULL; 617 Eina_List *outs = NULL;
613 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in); 618 Eina_List *copy = evas_event_list_copy(src->proxy->src_event_in);
619
614 EINA_LIST_FOREACH(copy, l, eo_child) 620 EINA_LIST_FOREACH(copy, l, eo_child)
615 { 621 {
616 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS); 622 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
@@ -621,11 +627,14 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
621 (!evas_event_freezes_through(eo_child, child)) && 627 (!evas_event_freezes_through(eo_child, child)) &&
622 (!child->clip.clipees)) 628 (!child->clip.clipees))
623 { 629 {
624 ev->cur.canvas = point; 630 ev->cur = curpt;
625 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x, 631 ev->prev = prevpt;
626 &ev->cur.canvas.y, 632 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
627 child->mouse_grabbed); 633 _evas_event_havemap_adjust_f(eo_child, child, &ev->prev, child->mouse_grabbed);
628 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, ev, event_id, pe, parent_pe); 634
635 ev->action = EFL_POINTER_ACTION_MOVE;
636 evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, NULL,
637 event_id, EFL_EVENT_POINTER_MOVE, evt);
629 } 638 }
630 else 639 else
631 outs = eina_list_append(outs, eo_child); 640 outs = eina_list_append(outs, eo_child);
@@ -633,28 +642,24 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
633 //FIXME: take care nograb object 642 //FIXME: take care nograb object
634 } 643 }
635 eina_list_free(copy); 644 eina_list_free(copy);
636 EV_RESET(pe);
637 645
638 while (outs) 646 EINA_LIST_FREE(outs, eo_child)
639 { 647 {
640 eo_child = outs->data;
641 outs = eina_list_remove(outs, eo_child);
642 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS); 648 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
643 if ((child->mouse_grabbed == 0) && (!e->delete_me)) 649 if ((child->mouse_grabbed == 0) && (!e->delete_me))
644 { 650 {
645 if (child->mouse_in) continue; 651 if (child->mouse_in) continue; /* FIXME: dubious logic! */
646 child->mouse_in = 0; 652 child->mouse_in = 0;
647 if (child->delete_me || e->is_frozen) continue; 653 if (child->delete_me || e->is_frozen) continue;
648 ev->cur.canvas = canvas; 654 ev->cur = curpt_real;
649 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x, 655 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
650 &ev->cur.canvas.y,
651 child->mouse_grabbed);
652
653 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write) 656 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write)
654 proxy_write->src_event_in = eina_list_remove(proxy_write->src_event_in, eo_child); 657 proxy_write->src_event_in = eina_list_remove(proxy_write->src_event_in, eo_child);
655 EINA_COW_WRITE_END(evas_object_proxy_cow, src->proxy, proxy_write); 658 EINA_COW_WRITE_END(evas_object_proxy_cow, src->proxy, proxy_write);
656 659
657 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, ev, event_id, pe, parent_pe); 660 ev->action = EFL_POINTER_ACTION_OUT;
661 evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, NULL,
662 event_id, EFL_EVENT_POINTER_OUT, evt);
658 } 663 }
659 } 664 }
660 } 665 }
@@ -666,7 +671,8 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
666 if (src->is_smart) 671 if (src->is_smart)
667 { 672 {
668 int no_rep = 0; 673 int no_rep = 0;
669 ins = _evas_event_object_list_raw_in_get(eo_e, ins, evas_object_smart_members_get_direct(eo_src), NULL, ev->cur.canvas.x, ev->cur.canvas.y, &no_rep, EINA_TRUE); 674 ins = _evas_event_object_list_raw_in_get(eo_e, ins, evas_object_smart_members_get_direct(eo_src),
675 NULL, ev->cur.x, ev->cur.y, &no_rep, EINA_TRUE);
670 } 676 }
671 else 677 else
672 ins = eina_list_append(ins, eo_src); 678 ins = eina_list_append(ins, eo_src);
@@ -675,11 +681,9 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
675 { 681 {
676 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS); 682 child = efl_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
677 683
678 ev->cur.canvas = point; 684 ev->cur = curpt;
679
680 if (evas_object_is_in_output_rect(eo_child, child, 685 if (evas_object_is_in_output_rect(eo_child, child,
681 ev->cur.canvas.x, 686 ev->cur.x, ev->cur.y, 1, 1) &&
682 ev->cur.canvas.y, 1, 1) &&
683 (evas_object_clippers_is_visible(eo_child, child) || 687 (evas_object_clippers_is_visible(eo_child, child) ||
684 child->mouse_grabbed) && 688 child->mouse_grabbed) &&
685 eina_list_data_find(ins, eo_child) && 689 eina_list_data_find(ins, eo_child) &&
@@ -687,27 +691,22 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
687 (!evas_event_freezes_through(eo_child, child)) && 691 (!evas_event_freezes_through(eo_child, child)) &&
688 (!child->clip.clipees) && 692 (!child->clip.clipees) &&
689 ((!child->precise_is_inside) || 693 ((!child->precise_is_inside) ||
690 evas_object_is_inside(eo_child, child, ev->cur.canvas.x, 694 evas_object_is_inside(eo_child, child, ev->cur.x, ev->cur.y)))
691 ev->cur.canvas.y)))
692 { 695 {
693 _evas_event_havemap_adjust(eo_child, child, &ev->cur.canvas.x, 696 ev->action = EFL_POINTER_ACTION_MOVE;
694 &ev->cur.canvas.y, 697 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
695 child->mouse_grabbed); 698 evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, NULL,
696 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, ev, event_id, pe, parent_pe); 699 event_id, EFL_EVENT_POINTER_MOVE, evt);
697 EV_RESET(pe);
698 } 700 }
699 else if (child->mouse_in) 701 else if (child->mouse_in)
700 { 702 {
701 child->mouse_in = 0; 703 child->mouse_in = 0;
702 if (e->is_frozen) continue; 704 if (e->is_frozen) continue;
703 ev->cur.canvas = point; 705 ev->cur = curpt;
704 _evas_event_havemap_adjust(eo_child, child, 706 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
705 &ev->cur.canvas.x, 707 ev->action = EFL_POINTER_ACTION_OUT;
706 &ev->cur.canvas.y, 708 evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, NULL,
707 child->mouse_grabbed); 709 event_id, EFL_EVENT_POINTER_OUT, evt);
708 // note: Mouse_Move and Mouse_Out are compatible (bad!)
709 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_OUT, ev, event_id, pe, parent_pe);
710 EV_RESET(pe);
711 if (e->delete_me) break; 710 if (e->delete_me) break;
712 711
713 } 712 }
@@ -726,13 +725,11 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
726 { 725 {
727 child->mouse_in = 1; 726 child->mouse_in = 1;
728 if (e->is_frozen) continue; 727 if (e->is_frozen) continue;
729 ev->cur.canvas = point; 728 ev->cur = curpt;
730 _evas_event_havemap_adjust(eo_child, child, 729 _evas_event_havemap_adjust_f(eo_child, child, &ev->cur, child->mouse_grabbed);
731 &ev->cur.canvas.x, 730 ev->action = EFL_POINTER_ACTION_IN;
732 &ev->cur.canvas.y, 731 evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_IN, NULL,
733 child->mouse_grabbed); 732 event_id2, EFL_EVENT_POINTER_IN, evt);
734 // note: Mouse_Move and Mouse_In are compatible (bad!)
735 EV_CALL(eo_child, child, EVAS_CALLBACK_MOUSE_IN, ev, event_id2, pe, parent_pe);
736 if (e->delete_me) break; 733 if (e->delete_me) break;
737 } 734 }
738 } 735 }
@@ -752,8 +749,8 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
752 if (ins) eina_list_free(ins); 749 if (ins) eina_list_free(ins);
753 } 750 }
754 } 751 }
755 ev->cur.canvas = canvas; 752
756 EV_DEL(pe); 753 efl_del(evt);
757} 754}
758 755
759static void 756static void
@@ -1885,7 +1882,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, Evas_Public_Data *e, int x, int
1885 { 1882 {
1886 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe); 1883 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe);
1887 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 1884 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
1888 _evas_event_source_mouse_move_events(eo_obj, eo_e, &ev, event_id, pemove); 1885 _evas_event_source_mouse_move_events(eo_obj, eo_e, pemove, event_id);
1889 } 1886 }
1890 } 1887 }
1891 else 1888 else
@@ -2039,7 +2036,7 @@ _canvas_event_feed_mouse_move_internal(Eo *eo_e, Evas_Public_Data *e, int x, int
2039 _evas_event_havemap_adjust(eo_obj, obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); 2036 _evas_event_havemap_adjust(eo_obj, obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed);
2040 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe); 2037 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe);
2041 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2038 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2042 _evas_event_source_mouse_move_events(eo_obj, eo_e, &ev, event_id, pemove); 2039 _evas_event_source_mouse_move_events(eo_obj, eo_e, pemove, event_id);
2043 } 2040 }
2044 } 2041 }
2045 /* otherwise it has left the object */ 2042 /* otherwise it has left the object */
@@ -2227,7 +2224,7 @@ nogrep:
2227 _evas_event_havemap_adjust(eo_obj, obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); 2224 _evas_event_havemap_adjust(eo_obj, obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed);
2228 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe); 2225 EV_CALL(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id, pemove, parent_pe);
2229 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2226 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2230 _evas_event_source_mouse_move_events(eo_obj, eo_e, &ev, event_id, pemove); 2227 _evas_event_source_mouse_move_events(eo_obj, eo_e, pemove, event_id);
2231 } 2228 }
2232 } 2229 }
2233 /* otherwise it has left the object */ 2230 /* otherwise it has left the object */