summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman.samsung@gmail.com>2019-01-24 11:34:12 -0600
committerDerek Foreman <derek.foreman.samsung@gmail.com>2019-01-25 13:00:43 -0600
commit41a9e1c8737c5167c7974c0f51aa1a531aad4b62 (patch)
treebcc7bdd3120809395c01993c65915e3fd5d472a8 /src
parent955c4bd4a0bf4d2167b4d3377ecdf97cd6401740 (diff)
gesture_manager: Use private data getter to save some lookups
We frequently process an array of several events at once, so we can now look up the gesture manager private data once for the entire array. Differential Revision: https://phab.enlightenment.org/D7763 Signed-off-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c14
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.c8
-rw-r--r--src/lib/evas/include/evas_private.h4
3 files changed, 18 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 6db38e81f4..37e62976ff 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -792,12 +792,17 @@ _check_event_catcher_add(void *data, const Efl_Event *event)
792 const Efl_Callback_Array_Item_Full *array = event->info; 792 const Efl_Callback_Array_Item_Full *array = event->info;
793 Evas_Object_Protected_Data *obj = data; 793 Evas_Object_Protected_Data *obj = data;
794 Evas_Callback_Type type = EVAS_CALLBACK_LAST; 794 Evas_Callback_Type type = EVAS_CALLBACK_LAST;
795 void *gd = NULL;
795 int i; 796 int i;
796 797
797 for (i = 0; array[i].desc != NULL; i++) 798 for (i = 0; array[i].desc != NULL; i++)
798 { 799 {
799 if (obj->layer->evas->gesture_manager) 800 if (obj->layer->evas->gesture_manager)
800 _efl_canvas_gesture_manager_callback_add_hook(obj->layer->evas->gesture_manager, obj->object, array[i].desc); 801 {
802 if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
803
804 _efl_canvas_gesture_manager_callback_add_hook(gd, obj->object, array[i].desc);
805 }
801 806
802 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK) 807 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
803 { 808 {
@@ -819,6 +824,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event)
819{ 824{
820 const Efl_Callback_Array_Item_Full *array = event->info; 825 const Efl_Callback_Array_Item_Full *array = event->info;
821 Evas_Object_Protected_Data *obj = data; 826 Evas_Object_Protected_Data *obj = data;
827 void *gd = NULL;
822 int i; 828 int i;
823 829
824 if (!obj->layer || 830 if (!obj->layer ||
@@ -828,7 +834,11 @@ _check_event_catcher_del(void *data, const Efl_Event *event)
828 for (i = 0; array[i].desc != NULL; i++) 834 for (i = 0; array[i].desc != NULL; i++)
829 { 835 {
830 if (obj->layer->evas->gesture_manager) 836 if (obj->layer->evas->gesture_manager)
831 _efl_canvas_gesture_manager_callback_del_hook(obj->layer->evas->gesture_manager, obj->object, array[i].desc); 837 {
838 if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
839
840 _efl_canvas_gesture_manager_callback_del_hook(gd, obj->object, array[i].desc);
841 }
832 842
833 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK) 843 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
834 { 844 {
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
index 793c0dbf67..cce00dfe19 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
@@ -106,9 +106,9 @@ _efl_canvas_gesture_manager_private_data_get(Eo *obj)
106} 106}
107 107
108void 108void
109_efl_canvas_gesture_manager_callback_add_hook(Eo *obj, Eo *target, const Efl_Event_Description *type) 109_efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type)
110{ 110{
111 Efl_Canvas_Gesture_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); 111 Efl_Canvas_Gesture_Manager_Data *pd = data;
112 // if there is a recognizer registered for that event then add it to the gesture context 112 // if there is a recognizer registered for that event then add it to the gesture context
113 Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type); 113 Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type);
114 if (recognizer) 114 if (recognizer)
@@ -119,9 +119,9 @@ _efl_canvas_gesture_manager_callback_add_hook(Eo *obj, Eo *target, const Efl_Eve
119} 119}
120 120
121void 121void
122_efl_canvas_gesture_manager_callback_del_hook(Eo *obj, Eo *target, const Efl_Event_Description *type) 122_efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type)
123{ 123{
124 Efl_Canvas_Gesture_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); 124 Efl_Canvas_Gesture_Manager_Data *pd = data;
125 // if there is a recognizer registered for that event then add it to the gesture context 125 // if there is a recognizer registered for that event then add it to the gesture context
126 Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type); 126 Efl_Canvas_Gesture_Recognizer *recognizer = eina_hash_find (pd->m_recognizers, &type);
127 if (recognizer) 127 if (recognizer)
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index ba1d21651c..8599369ae9 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1898,8 +1898,8 @@ void evas_object_pixels_get_force(Evas_Object *eo_obj, Evas_Object_Protected_Dat
1898// Gesture Manager 1898// Gesture Manager
1899void *_efl_canvas_gesture_manager_private_data_get(Eo *obj); 1899void *_efl_canvas_gesture_manager_private_data_get(Eo *obj);
1900void _efl_canvas_gesture_manager_filter_event(Eo *gesture_manager, Eo *target, void *event); 1900void _efl_canvas_gesture_manager_filter_event(Eo *gesture_manager, Eo *target, void *event);
1901void _efl_canvas_gesture_manager_callback_del_hook(Eo *gesture_manager, Eo *target, const Efl_Event_Description *type); 1901void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type);
1902void _efl_canvas_gesture_manager_callback_add_hook(Eo *gesture_manager, Eo *target, const Efl_Event_Description *type); 1902void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type);
1903 1903
1904//evas focus functions 1904//evas focus functions
1905void evas_focus_init(void); 1905void evas_focus_init(void);